split a string with quoted parts into list
maxm at mxm.dk
Thu Mar 10 11:28:13 CET 2005
> hi there
> i'm experimanting with imaplib and came across stringts like
> (\HasNoChildren) "." "INBOX.Sent Items"
> in which the quotes are part of the string.
> now i try to convert this into a list. assume the string is in the variable
> f, then i tried
> but i end up with
> ['(\\HasNoChildren)', '"."', '"INBOX.Sent', 'Items"']
> so due to the sapce in "Sent Items" its is sepearted in two entries, what i
> don't want.
> is there another way to convert a string with quoted sub entries into a list
> of strings?
In Twisteds protocols/imap4.py module there is a function called
parseNestedParens() that can be ripped out of the module.
I have used it for another project and put it into this attachment.
hilsen/regards Max M, Denmark
IT's Mad Science
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Python-list