Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'output': 0.05; 'amtsgericht': 0.07; 'hrb': 0.07; 'none,': 0.07; 'subject: [': 0.09; 'subject:None': 0.09; 'thats': 0.09; '[none,': 0.16; 'none.': 0.16; 'none]': 0.16; 'rainer': 0.16; 'ralf': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'gmbh': 0.22; 'print': 0.22; 'header :User-Agent:1': 0.23; 'germany': 0.24; 'header:In-Reply-To:1': 0.27; 'subject:the': 0.34; 'there': 0.35; 'subject:]': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'length': 0.61; 'received:194': 0.64; 'skip:+ 10': 0.65; 'tel.:': 0.65; 'press': 0.70; 'power': 0.76; 'subject:have': 0.80; 'received:192.168.57': 0.84 Date: Thu, 10 Apr 2014 15:59:48 +0200 From: Johannes Schneider User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 MIME-Version: 1.0 To: python-list@python.org Subject: Re: why i have the output of [None, None, None] References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397140019 news.xs4all.nl 2879 [2001:888:2000:d::a6]:50839 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70042 because thats the return value of [...] print retuns None. On 10.04.2014 15:54, length power wrote: > >>> x=['','x1','x2','x3',' '] > >>> x > ['', 'x1', 'x2', 'x3', ' '] > >>> [print("ok") for it in x if it.strip() !=""] > ok > ok > ok > [None, None, None] > > i understand there are three 'ok' in the output,but why i have the > output of [None, None, None] > > -- Johannes Schneider Webentwicklung johannes.schneider@galileo-press.de Tel.: +49.228.42150.xxx Galileo Press GmbH Rheinwerkallee 4 - 53227 Bonn - Germany Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax) http://www.galileo-press.de/ Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker HRB 8363 Amtsgericht Bonn