Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55946
| 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 | <bsk16@case.edu> |
| 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 | <AANLkTi=mnNZz221G_TZ8AJXHXE9A9OcmgpO-gzVHo77y@mail.gmail.com> |
| References | <AANLkTi=mnNZz221G_TZ8AJXHXE9A9OcmgpO-gzVHo77y@mail.gmail.com> |
| Date | Thu, 3 Feb 2011 10:30:51 -0500 |
| Subject | Re: Errors while using strip and remove on a variable. |
| From | Benjamin Kaplan <benjamin.kaplan@case.edu> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1616.1296747063.6505.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
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