def splits(seq, cs): if not cs: return seq elif isinstance(seq, str): return splits(seq.split(cs[0]), cs[1:]) else: return splits(sum([elem.split(cs[0]) for elem in seq], []), cs[1:])
or a = re.split('(\ |\,)', a) a.remove(' ') a.remove(',') Matthias Winterland wrote: > Hi, > > I have a simple question. When I read in a string like: > a='1,2,3,4,5 6 7,3,4', can I get the list l=[1,2,3,4,5,6,7,3,4] with a > single split-call? > > Thx, > Matthias -- http://mail.python.org/mailman/listinfo/python-list