string = 'this string has digits 12345'
if any(char.isdigit() for char in string):
#digits found
print('"{}" has digits!'.format(string))
else:
#digits NOT found
print('"{}" does NOT have digits!'.format(string))
>>> 'A'.isdigit()
False
>>> '1'.isdigit()
True
s = "abc1"
contains_digit = any(map(str.isdigit, s))
print(contains_digit)
def containsNumber(value):
for character in value:
if character.isdigit():
return False
return True
for number in numbers:
if '4' in str(number):
print('{} True'.format(number))
else:
print("False")
s = set(str(4059304593))
print('2' in s)