On 08/10/12 19:31, Steven D'Aprano wrote:
re.search(r'\d', 'I 8 sandwiches').start()
# returns 2
I knew there was a better way that using index
and group but I couldn't think what it was...
start() so obvious once you see it :-)
--
Alan G
Author of the Learn to Program web site
http://www.a
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 us
On 08/10/12 17: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,
When looking for patterns rather than literal values you need to use
regular expressions. These
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.
___
Tutor maillist - Tutor@python.org
To unsubscribe or c