Errors while using strip and remove on a variable.

Benjamin Kaplan benjamin.kaplan at case.edu
Thu Feb 3 16:30:51 CET 2011


On Thu, Feb 3, 2011 at 10:21 AM, anand jeyahar <anand.ibmgsi at 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.



More information about the Python-list mailing list