Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Sandhya Prabhakaran
Oh yes indeed! Now that works :D Thanks a lot !! 2009/8/3 Kushal Kumaran > > On Mon, Aug 3, 2009 at 8:47 PM, Sandhya > Prabhakaran wrote: > > Hi, > > > > I have a string as str='123ACTGAAC'. > > > > I need to extract the numeric part from the alphabetic part which I > > did using >

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread alex23
Sandhya Prabhakaran wrote: > I have a string as str='123ACTGAAC'. You shouldn't use 'str' as a label like that, it prevents you from using the str() function in the same body of code. > How do I blank out the initial numeric part so as to get just the > alphabetic part. The string is always in t

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Kushal Kumaran
On Mon, Aug 3, 2009 at 8:47 PM, Sandhya Prabhakaran wrote: > Hi, > > I have a string as str='123ACTGAAC'. > > I need to extract the numeric part from the alphabetic part which I > did using numer=re.findall(r'\d+',str) numer > 123 > The docs for re.findall say that it returns a list of mat

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread MRAB
Sandhya Prabhakaran wrote: Hi, I have a string as str='123ACTGAAC'. I need to extract the numeric part from the alphabetic part which I did using numer=re.findall(r'\d+',str) numer 123 [snip] I get: ['123'] which is a _list_ of the strings found. -- http://mail.python.org/mailman/listinf

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Peter Brett
Sandhya Prabhakaran writes: > Hi, > > I have a string as str='123ACTGAAC'. > > I need to extract the numeric part from the alphabetic part which I > did using numer=re.findall(r'\d+',str) numer > 123 > > To get the alphabetic part, I could do alpha=str.replace('123','') alpha > AC

RE: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Andreas Tawn
> Hi, > > I have a string as str='123ACTGAAC'. > > I need to extract the numeric part from the alphabetic part which I > did using > >>>numer=re.findall(r'\d+',str) > >>>numer > 123 > > To get the alphabetic part, I could do > >>>alpha=str.replace('123','') > >>>alpha > ACTGAAC > But when I giv

Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Sandhya Prabhakaran
Hi, I have a string as str='123ACTGAAC'. I need to extract the numeric part from the alphabetic part which I did using >>>numer=re.findall(r'\d+',str) >>>numer 123 To get the alphabetic part, I could do >>>alpha=str.replace('123','') >>>alpha ACTGAAC But when I give >>>alpha=str.replace(numer,''