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


Groups > comp.lang.python > #64869

Re: Remove unwanted characters from column

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; 'elif': 0.05; 'column': 0.07; 'subject:characters': 0.09; 'cc:addr:python- list': 0.11; 'jan': 0.12; 'commonly,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:Remove': 0.16; 'wrote:': 0.18; 'written': 0.21; 'cc:addr:python.org': 0.22; 'instead.': 0.24; 'cc:2**0': 0.24; 'define': 0.26; 'handling': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'character': 0.29; 'characters': 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'figure': 0.32; 'limitation': 0.33; 'monday,': 0.33; 'subject:from': 0.34; "can't": 0.35; 'received:google.com': 0.35; 'should': 0.36; 'january': 0.37; 'two': 0.37; 'issue': 0.38; 'how': 0.40; 'remove': 0.60; 'address': 0.63; 'more': 0.64; '100': 0.79; '10:': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=vqSNRwQa453N/4Hk0EZwrVLNjLtffe3avliTH/opicQ=; b=hw5GBXY+dtNFKNmnVLrhH0nX3b5DykTxqf00GekMtTzNPBRdh5QzpqMXS1XuSTq4P3 dNlktRvXXVosoX48ogjxCuzkcP4VcXgwA+8Auccl4AWFPt+RioH7kr9yF0jcMPfYceSL 0sjuxJSlHxqCHepAgXb8sxrlxiSTK+1OuRMH5QbCbM3S57Sb59lawWR1QMFlUziTp3Na ls4vc017nOp58qX+FoHlz0gCFuOR+ouJSTr4MKABRbO78R2xvjhEDatM9HUuMUZRQUWb Ksyw6bRGqJo5pZDJwaueBCzvze/46QyCVHUkz/FAAz55IPjXEFzgUp7CeD6SOtNEDeyX 8fIw==
MIME-Version 1.0
X-Received by 10.66.118.71 with SMTP id kk7mr30673327pab.14.1390835999072; Mon, 27 Jan 2014 07:19:59 -0800 (PST)
In-Reply-To <948612d7-8e69-46d0-9fab-707b762a48a7@googlegroups.com>
References <8d703876-ba90-492d-a558-a5a9bb8023c7@googlegroups.com> <mailman.6019.1390800112.18130.python-list@python.org> <04d509f9-54fa-4ba5-bb6e-24ce60e12523@googlegroups.com> <52e6650c$0$29999$c3e8da3$5496439d@news.astraweb.com> <9b121fe6-9ed8-4adf-af24-80166f348c7d@googlegroups.com> <mailman.6044.1390834662.18130.python-list@python.org> <948612d7-8e69-46d0-9fab-707b762a48a7@googlegroups.com>
Date Tue, 28 Jan 2014 02:19:59 +1100
Subject Re: Remove unwanted characters from column
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6045.1390836009.18130.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1390836009 news.xs4all.nl 2830 [2001:888:2000:d::a6]:58257
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:64869

Show key headers only | View raw


On Tue, Jan 28, 2014 at 2:03 AM,  <matt.s.marotta@gmail.com> wrote:
> On Monday, 27 January 2014 09:57:32 UTC-5, Chris Angelico  wrote:
>> On Tue, Jan 28, 2014 at 1:23 AM,  <matt.s.marotta@gmail.com> wrote:
>>
>> > If the farmID < 10:
>> > remove one character from the address column
>> > Elif farmID > 10:
>> > remove two characters from the address column
>>
>> What if farmID == 10?
>>
>> ChrisA
>
> Ok, sorry this is how it should be.
>
> If the FarmID < 10:
> remove one character from the address column
>
> If the FarmID > 9:
> remove two characters from the address column
>
> My issue is I can't figure out what statement to use to define FarmID.

More commonly, that would be written as

if farmID < 10:
    # remove one character
else:
    # remove two characters

Though this still suffers from the limitation of not handling 100 or
1000, so you might want to look at len(str(farmID)) instead.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Remove unwanted characters from column matt.s.marotta@gmail.com - 2014-01-26 19:49 -0800
  Re:Remove unwanted characters from column Dave Angel <davea@davea.name> - 2014-01-27 00:24 -0500
    Re: Remove unwanted characters from column matt.s.marotta@gmail.com - 2014-01-27 05:32 -0800
      Re: Remove unwanted characters from column Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-27 13:54 +0000
        Re: Remove unwanted characters from column matt.s.marotta@gmail.com - 2014-01-27 06:23 -0800
          Re: Remove unwanted characters from column Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-27 14:34 +0000
          Re: Remove unwanted characters from column Chris Angelico <rosuav@gmail.com> - 2014-01-28 01:57 +1100
            Re: Remove unwanted characters from column matt.s.marotta@gmail.com - 2014-01-27 07:03 -0800
              Re: Remove unwanted characters from column Chris Angelico <rosuav@gmail.com> - 2014-01-28 02:19 +1100
  Re: Remove unwanted characters from column Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-27 15:22 +0000

csiph-web