0
how to check if there is "A1" sequence somwhere in string?
e.g: if string = "A1BBD5" then it should return True else False because ithas "A1" or if string = "BOOEZP4HTIN3G3WMLQ1M7FMB" it should return False because there is no "A1".
1 Resposta
+ 2
string = “A1BBD5”
pattern = “A1”
if pattern in string:
print(‘Found it!’)
or simple
print(pattern in string)
or as a function
def check(string, pattern):
return pattern in string