Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55946
| References | <AANLkTi=mnNZz221G_TZ8AJXHXE9A9OcmgpO-gzVHo77y@mail.gmail.com> |
|---|---|
| Date | 2011-02-03 10:30 -0500 |
| Subject | Re: Errors while using strip and remove on a variable. |
| From | Benjamin Kaplan <benjamin.kaplan@case.edu> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1616.1296747063.6505.python-list@python.org> (permalink) |
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.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Errors while using strip and remove on a variable. Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-02-03 10:30 -0500
csiph-web