splitting delimited strings
Nicola Mingotti
nicola-mingotti at libero.it
Wed Jun 15 21:28:58 EDT 2005
On Wed, 15 Jun 2005 23:03:55 +0000, Mark Harrison wrote:
> What's the most efficient way to process this? Failing all
> else I will split the string into characters and use a FSM,
> but it seems that's not very pythonesqe.
like this ?
>>> s = "@hello at world@@foo at bar"
>>> s.split("@")
['', 'hello', 'world', '', 'foo', 'bar']
>>> s2 = "hello at world@@foo at bar"
>>> s2
'hello at world@@foo at bar'
>>> s2.split("@")
['hello', 'world', '', 'foo', 'bar']
>>>
bye
More information about the Python-list
mailing list