[Numpy-discussion] String manipulation

Nils Wagner nwagner at iam.uni-stuttgart.de
Mon May 11 08:36:17 EDT 2009


On Mon, 11 May 2009 14:25:46 +0200
  Francesc Alted <faltet at pytables.org> wrote:
> A Monday 11 May 2009, Nils Wagner escrigué:
>> Hi all,
>>
>> Please consider two strings
>>
>> >>> line_a
>>
>> '12345678abcdefgh12345678'
>>
>> >>> line_b
>>
>> '12345678 abcdefgh 12345678'
>>
>> >>> line_b.split()
>>
>> ['12345678', 'abcdefgh', '12345678']
>>
>> Is it possible to split line_a such that the output
>> is
>>
>> ['12345678', 'abcdefgh', '12345678']
> 
> Mmh, your question is a bit too generic. 

Indeed.
I would like to split strings made of digits after eight 
characters each.

>>> line_a
'111111.1222222.2333333.3'

>>> line_b
'111111.1 222222.2 333333.3'
  
>>> line_b.split()
['111111.1', '222222.2', '333333.3']

How can I accomplish that ?

Nils



More information about the NumPy-Discussion mailing list