Extract the numeric and alphabetic part from an alphanumeric string

MRAB python at mrabarnett.plus.com
Mon Aug 3 17:43:30 CEST 2009


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.



More information about the Python-list mailing list