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


Groups > comp.lang.python > #55946 > unrolled thread

Re: Errors while using strip and remove on a variable.

Started byBenjamin Kaplan <benjamin.kaplan@case.edu>
First post2011-02-03 10:30 -0500
Last post2011-02-03 10:30 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Errors while using strip and remove on a variable. Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-02-03 10:30 -0500

#55946 — Re: Errors while using strip and remove on a variable.

FromBenjamin Kaplan <benjamin.kaplan@case.edu>
Date2011-02-03 10:30 -0500
SubjectRe: Errors while using strip and remove on a variable.
Message-ID<mailman.1616.1296747063.6505.python-list@python.org>
On Thu, Feb 3, 2011 at 10:21 AM, anand jeyahar <anand.ibmgsi@gmail.com> wrote:
> Hi,
>     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 assignment.
> please find the script below*
>
> a ='oe,eune,eueo, ,u'
> b = a.split(',')
> print b
> c = 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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web