Simple question to split

faulkner faulkner612 at
Fri Nov 10 00:02:00 CET 2006

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], []),

a = re.split('(\ |\,)', a)
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

More information about the Python-list mailing list