i Petre
Cc: tutor@python.org
Subject: Re: [Tutor] tokenizing a simple string with split()
Andrei Petre wrote:
> I want to split a string like "C:\My\Doc\;D:\backup\" with two
> separators: \ and ;
> I found that \ is handled with /raw string/ notation r"". But the
>
Andrei Petre wrote:
> I want to split a string like "C:\My\Doc\;D:\backup\" with two
> separators: \ and ;
> I found that \ is handled with /raw string/ notation r"". But the
> problem i encountered is with split() function.
> In the 2.5 reference is said that "The sep argument of the split()
>
I think by "multiple characters" they mean more than one character for
ONE separator. I don't know how to specify multiple separators. You
could try something like this:
s = "spam;egg mail"
list = []
for t in s.split(";"):
for u in t.split(" "):
list.append(u)
which yields:
list = ['
I want to split a string like "C:\My\Doc\;D:\backup\" with two separators: \
and ;
I found that \ is handled with *raw string* notation r"". But the problem i
encountered is with split() function.
In the 2.5 reference is said that "The sep argument of the split() function
may consist of multiple c