python - regex to check if a number exists in a string -


i have list. want check if contains number

list1 = [u'studied @ ', u'south city college, kolkata', u'class of 2012', u'lives in   ', u'calcutta, india', u'from ', u'calcutta, india'] >>> if re.match(r'[\w-]+$', str(list1)):     print "contains number" else:     print "does not contain number" 

it not contain number. need help. want output "2012"

just re.search pattern \d. don't re.match, matches start of string.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -