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: 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 To: mingqiang hu , "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: In-Reply-To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 > I have a question about the split function? surpose a =3D "|",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