Re: [Tutor] finding digit in string

2012-10-08 Thread eryksun
On Mon, Oct 8, 2012 at 4:11 PM, Prasad, Ramit wrote: > >> for ch in text: >> if '0' <= ch <= '9': >> doSomething(ch) > > I am not sure that will work very well with Unicode numbers. I would > assume (you know what they say about assuming) that str.isdigit() > works better with intern

Re: [Tutor] finding digit in string

2012-10-08 Thread Prasad, Ramit
Mark Lawrence wrote: > On 08/10/2012 17:43, Benjamin Fishbein wrote: > > I figured out a solution for the question I asked on here. > > To find the next digit (0-9) in a string, I use: > > text.find("0" or "1" or "2", etc...) > > But is there a more elegant way to do this? The way I found uses

Re: [Tutor] finding digit in string

2012-10-08 Thread bob gailer
On 10/8/2012 12:43 PM, Benjamin Fishbein wrote: I figured out a solution for the question I asked on here. To find the next digit (0-9) in a string, I use: text.find("0" or "1" or "2", etc...) > But is there a more elegant way to do this? The way I found uses a lot of typing. My way is: i

Re: [Tutor] finding digit in string

2012-10-08 Thread Dave Angel
On 10/08/2012 12:43 PM, Benjamin Fishbein wrote: > I figured out a solution for the question I asked on here. Why then did you start a new thread, instead of responding on the same one? You didn't even use the same subject string. > To find the next digit (0-9) in a string, I use: > text.find("0

Re: [Tutor] finding digit in string

2012-10-08 Thread Alan Gauld
On 08/10/12 17:43, Benjamin Fishbein wrote: I figured out a solution for the question I asked on here. To find the next digit (0-9) in a string, I use: text.find("0" or "1" or "2", etc...) Are you sure that worked? It doesn't for me on Python 2.7... >>> s 'a string with 7 words in it' >>>

Re: [Tutor] finding digit in string

2012-10-08 Thread Mark Lawrence
On 08/10/2012 17:43, Benjamin Fishbein wrote: I figured out a solution for the question I asked on here. To find the next digit (0-9) in a string, I use: text.find("0" or "1" or "2", etc...) But is there a more elegant way to do this? The way I found uses a lot of typing. ___

[Tutor] finding digit in string

2012-10-08 Thread Benjamin Fishbein
I figured out a solution for the question I asked on here. To find the next digit (0-9) in a string, I use: text.find("0" or "1" or "2", etc...) But is there a more elegant way to do this? The way I found uses a lot of typing. ___ Tutor maillist -