Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:using': 0.04; 'assign': 0.05; 'subject:while': 0.05; 'python': 0.08; 'anand': 0.09; 'modifies': 0.09; 'subject:remove': 0.09; 'am,': 0.13; 'wrote:': 0.14; 'assignment.': 0.16; 'guessing': 0.16; 'variable.': 0.16; 'feb': 0.16; 'handles': 0.19; 'fine': 0.22; 'trying': 0.22; 'none,': 0.23; 'script.': 0.23; 'header:In-Reply- To:1': 0.23; 'skip:= 10': 0.24; '\xa0\xa0\xa0': 0.24; 'script': 0.25; 'string': 0.27; 'message-id:@mail.gmail.com': 0.29; 'list': 0.31; 'to:addr:python-list': 0.31; 'thu,': 0.31; "doesn't": 0.32; 'none': 0.32; 'running': 0.34; 'hi,': 0.34; 'print': 0.35; 'but': 0.36; 'anything': 0.36; 'set': 0.37; 'works': 0.38; 'received:209.85': 0.38; 'received:google.com': 0.38; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; '10:21': 0.84 MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 3 Feb 2011 10:30:51 -0500 Subject: Re: Errors while using strip and remove on a variable. From: Benjamin Kaplan To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 24 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1296747063 news.xs4all.nl 41117 [::ffff:82.94.164.166]:60526 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:55946 On Thu, Feb 3, 2011 at 10:21 AM, anand jeyahar wro= te: > Hi, > =A0=A0=A0 I am trying to strip a string and then remove on the resulting = list to > remove a set of characters. It works fine with the python shell. > > But after remove the list becomes None, when i am running it from within = a > script. > > I am guessing it has something to do with the way python handles assignme= nt. > please find the script below* > > a =3D'oe,eune,eueo, ,u' > b =3D a.split(',') > print b > c =3D b.remove('oe') The remove method of a list modifies the list in place and doesn't return anything (Therefore, it returns None because every function/method in Python has to return something). There's no need to assign the result to a variable.