Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27034
| From | Andreas Tawn <andreas.tawn@ubisoft.com> |
|---|---|
| Date | 2012-08-14 11:44 +0200 |
| Subject | RE: something about split()??? |
| References | <CADYZVBDSGb=KL+KgvEG1j1jFnqjKifk6RBJd8C0mKk83rR+_HA@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3262.1344938735.4697.python-list@python.org> (permalink) |
> I have a question about the split function? surpose a = "|",and when I use a.split("|") , I got the list
> ['"",""] ,but I want to get the empty list,what should I do ?
Something like...
>>> [x for x in "|".split("|") if x]
[]
Cheers,
Drea
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: something about split()??? Andreas Tawn <andreas.tawn@ubisoft.com> - 2012-08-14 11:44 +0200
csiph-web