M
mrkafk
Hello everyone,
OK, so I want to split a string c into words using several different
separators from a list (dels).
I can do this the following C-like way:
cp=[]
for i in xrange(0,len(c)-1):
cp.extend(c.split(j))
c=cp
['ab', 'd', '', 'ab', '', '']
But. Surely there is a more Pythonic way to do this?
I cannot do this:
c=[x.split(i) for x in c]
because x.split(i) is a list.
OK, so I want to split a string c into words using several different
separators from a list (dels).
I can do this the following C-like way:
cp=[]
for i in xrange(0,len(c)-1):
cp.extend(c.split(j))
c=cp
['ab', 'd', '', 'ab', '', '']
But. Surely there is a more Pythonic way to do this?
I cannot do this:
c=[x.split(i) for x in c]
because x.split(i) is a list.