[Numpy-discussion] String manipulation

Alan G Isaac aisaac@american....
Mon May 11 09:41:11 CDT 2009


On 5/11/2009 8:03 AM Nils Wagner apparently wrote:
>>>> line_a
> '12345678abcdefgh12345678'
> Is it possible to split line_a such that the output
> is
> 
> ['12345678', 'abcdefgh', '12345678']


More of a comp.lang.python question, I think:

out = list()
for k, g in groupby('123abc456',lambda x: x.isalpha()): out.append( ''.join(g) )

fwiw,
Alan Isaac



More information about the Numpy-discussion mailing list