thanks. Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > are there a strtok equivalent in python ? str.split() only takes single > > seperator. > > use a regular expression split with a character group: > > >>> s = "breakfast=spam+egg-bacon" > >>> import re > >>> re.split("[-+=]", s) > ['breakfast', 'spam', 'egg', 'bacon'] > > to deal with an arbitrary set of delimiting characters without having to > bother with RE syntax, use re.escape: > > >>> re.split("[" + re.escape("-+=") + "]", s) > ['breakfast', 'spam', 'egg', 'bacon'] > > </F>
-- http://mail.python.org/mailman/listinfo/python-list