Re: splitting delimited strings

2005-06-15 Thread Nicola Mingotti
On Wed, 15 Jun 2005 23:03:55 +, 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 = "@[EMAIL PROTECTED]@@[EMAIL PROTECTED]"
>>> s.split("@")
['', 'hello', 'world', '', 'foo', 'bar']
>>> s2 = "[EMAIL PROTECTED]@@[EMAIL PROTECTED]"
>>> s2
'[EMAIL PROTECTED]@@[EMAIL PROTECTED]'
>>> s2.split("@")
['hello', 'world', '', 'foo', 'bar']
>>> 

bye
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: splitting delimited strings

2005-06-15 Thread Nicola Mingotti
On Thu, 16 Jun 2005 09:36:56 +1000, John Machin wrote:

>> like this ?
> 
> No, not like that. The OP said that an embedded @ was doubled.

you are right, sorry :)

anyway, if @@ -> @ 
an empty field map to what ? 



-- 
http://mail.python.org/mailman/listinfo/python-list