<div>(Much) more Pythonic solution:</div><div>>>> filter(None,"|".split("|"))</div><br><div class="gmail_quote">On 14 August 2012 15:14, Andreas Tawn <span dir="ltr"><<a href="mailto:andreas.tawn@ubisoft.com" target="_blank">andreas.tawn@ubisoft.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> I have a question about the split function? surpose a = "|",and when I use a.split("|") , I got the list<br>
> ['"",""] ,but I want to get the empty list,what should I do ?<br>
<br>
</div>Something like...<br>
<br>
>>> [x for x in "|".split("|") if x]<br>
[]<br>
<br>
Cheers,<br>
<br>
Drea<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br>