something about split()???

Andreas Tawn andreas.tawn at ubisoft.com
Tue Aug 14 05:44:14 EDT 2012


> 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



More information about the Python-list mailing list