Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64869
| References | (2 earlier) <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 | 2014-01-28 02:19 +1100 |
| Subject | Re: Remove unwanted characters from column |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6045.1390836009.18130.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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