Re: Reading after a symbol..

2010-10-12 Thread Chris Rebert
On Tue, Oct 12, 2010 at 1:48 PM, Pratik Khemka wrote: > Say :  line = abcdabcd#12 adssda > > index = line.find('#') > num = line[index:index+2] > > num will now be 12. No, num will be "#1". You wanted: num = line[index+1:index+3] > Likewise I want to read the number after the '#' and store it in

Re: Reading after a symbol..

2010-10-12 Thread Jonas H.
On 10/12/2010 10:48 PM, Pratik Khemka wrote: Likewise I want to read the number after the '#' and store it in num. The problem is that the number can be a 1/2/3/4 digit number. So is there a way in which I can define num so that it contains the number after '#' irrespective of how many digits

Reading after a symbol..

2010-10-12 Thread Pratik Khemka
Say : line = abcdabcd#12 adssda index = line.find('#') num = line[index:index+2] num will now be 12. Likewise I want to read the number after the '#' and store it in num. The problem is that the number can be a 1/2/3/4 digit number. So is there a way in which I can define num so t