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


Groups > comp.lang.python > #27034

RE: something about split()???

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <andreas.tawn@ubisoft.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'from:addr:andreas.tawn': 0.16; 'from:addr:ubisoft.com': 0.16; 'from:name:andreas tawn': 0.16; 'function?': 0.16; 'message-id:@PDC-MAIL-CMS01.ubisoft.org': 0.16; 'received:195.22.144': 0.16; 'received:195.22.144.43': 0.16; 'received:pdc-mail-out01.ubisoft.fr': 0.16; 'received:ubisoft.fr': 0.16; '>>>': 0.18; 'to:name:python-list@python.org': 0.20; 'cheers,': 0.23; 'split': 0.23; 'to:2**1': 0.23; 'header:In-Reply- To:1': 0.25; 'question': 0.27; 'to:addr:python-list': 0.33; 'list': 0.35; 'something': 0.35; 'received:fr': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40
From Andreas Tawn <andreas.tawn@ubisoft.com>
To mingqiang hu <humingqiang5262131@gmail.com>, "python-list@python.org" <python-list@python.org>
Date Tue, 14 Aug 2012 11:44:14 +0200
Subject RE: something about split()???
Thread-Topic something about split()???
Thread-Index Ac15/vD1Qvng15HwTYWJC+mXOrsVswAAcYfA
References <CADYZVBDSGb=KL+KgvEG1j1jFnqjKifk6RBJd8C0mKk83rR+_HA@mail.gmail.com>
In-Reply-To <CADYZVBDSGb=KL+KgvEG1j1jFnqjKifk6RBJd8C0mKk83rR+_HA@mail.gmail.com>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
acceptlanguage en-US
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3262.1344938735.4697.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1344938735 news.xs4all.nl 6950 [2001:888:2000:d::a6]:57608
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:27034

Show key headers only | View raw


> 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


Thread

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

csiph-web