string.split escaping

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Thu May 29 02:37:54 EDT 2003


> From: Dave Harrison [mailto:dave at nullcube.com]
> 
> Ok I should probably change the post a little ...
> 
> My intention (as the subject suggested) was to find a way of 
> escaping the
> split value.
> 
> This means I want to be able to ignore my split character at 
> any part of the string ... not just at the end, so maxsplit 
> isnt what Im after.

You'll need to improve that specification somewhat. For example, the following code meets that specification:

a = 'dog;cat;big;dog'
b = a

It ignores the split character in any part of the string.

Probably the easiest thing to do is perform the split, then rejoin those parts that you don't want split.

Tim Delaney





More information about the Python-list mailing list