On 09/10/12 03:33, Benjamin Fishbein wrote:
Is there a way to find the next character that is a digit (0-9) in a string? It seems that the str.find method can only find one particular character, rather than any character from among many.
Correct. For more complicated searching needs, either use a proper parser to parse the string as needed, or use a regular expression as a kind of "super-find". import re re.search(r'\d', 'I 8 sandwiches').start() # returns 2 Beware though: there is a saying about regular expressions, and in particular about the sort of people who reach for a reg ex to solve nearly every problem: "Some people, when faced with a problem, think 'I know, I'll use a regular expression'. Now they have two problems." -- Steven _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor