Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27034 > unrolled thread

RE: something about split()???

Started byAndreas Tawn <andreas.tawn@ubisoft.com>
First post2012-08-14 11:44 +0200
Last post2012-08-14 11:44 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  RE: something about split()??? Andreas Tawn <andreas.tawn@ubisoft.com> - 2012-08-14 11:44 +0200

#27034 — RE: something about split()???

FromAndreas Tawn <andreas.tawn@ubisoft.com>
Date2012-08-14 11:44 +0200
SubjectRE: something about split()???
Message-ID<mailman.3262.1344938735.4697.python-list@python.org>
> 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web