Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64477
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.068 |
| X-Spam-Evidence | '*H*': 0.87; '*S*': 0.00; 'subject:number': 0.09; 'cc:addr:python-list': 0.11; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'line.split()': 0.16; 'need:': 0.16; 'wrote:': 0.18; 'result.': 0.19; 'split': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; "skip:' 10": 0.31; 'raised': 0.31; 'but': 0.35; 'there': 0.35; 'addresses,': 0.36; 'crazy': 0.36; 'method': 0.36; 'charset:us- ascii': 0.36; 'ben': 0.38; 'john': 0.61; 'simple': 0.61; 'address': 0.63; 'hunter': 0.84; 'hutchinson': 0.84; 'received:50.22': 0.84; 'stone': 0.84; 'to:addr:gordon': 0.84 |
| Date | Tue, 21 Jan 2014 21:03:42 -0600 |
| From | Tim Chase <python.list@tim.thechases.com> |
| To | John Gordon <gordon@panix.com> |
| Subject | Re: Separate Address number and name |
| In-Reply-To | <lbnbdn$69j$1@reader1.panix.com> |
| References | <9fe1b47b-65ce-4063-9188-07b81cdba49f@googlegroups.com> <lbnbdn$69j$1@reader1.panix.com> |
| X-Mailer | Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - boston.accountservergroup.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - tim.thechases.com |
| X-Get-Message-Sender-Via | boston.accountservergroup.com: authenticated_id: tim@thechases.com |
| Cc | python-list@python.org |
| 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.5828.1390359774.18130.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1390359774 news.xs4all.nl 2850 [2001:888:2000:d::a6]:46621 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:64477 |
Show key headers only | View raw
On 2014-01-22 02:46, John Gordon wrote:
> > FarmID AddressNum AddressName
> > 1 1067 Niagara Stone
> > 2 4260 Mountainview
> > 3 25 Hunter
> > 4 1091 Hutchinson
>
> > I have struggled with this for a while and know there must be a
> > simple method to achieve this result.
>
> for line in input_lines:
> fields = line.split()
> farm_id = fields[0]
> address_num = fields[1]
> address_name = ' '.join(fields[2:])
Or, you can split of just the parts you need:
for line in input_lines:
farm_id, street_no, street_name = line.split(None, 2)
It doesn't address the issues that Ben raised about the crazy formats
you can find in addresses, but address-parsing is an twisty maze of
passages all alike.
-tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Separate Address number and name Shane Konings <shane.konings@gmail.com> - 2014-01-21 15:49 -0800
Re: Separate Address number and name Anders Wegge Keller <wegge@wegge.dk> - 2014-01-22 00:55 +0100
Re: Separate Address number and name Shane Konings <shane.konings@gmail.com> - 2014-01-21 16:01 -0800
Re: Separate Address number and name Shane Konings <shane.konings@gmail.com> - 2014-01-21 16:06 -0800
Re: Separate Address number and name Anders Wegge Keller <wegge@wegge.dk> - 2014-01-22 02:04 +0100
Re: Separate Address number and name Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-22 10:08 +0000
Re: Separate Address number and name Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-22 17:35 +0000
Re: Separate Address number and name Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-23 18:11 +0000
Re: Separate Address number and name Asaf Las <roegltd@gmail.com> - 2014-01-21 16:08 -0800
Re: Separate Address number and name Ben Finney <ben+python@benfinney.id.au> - 2014-01-22 11:08 +1100
Re: Separate Address number and name John Gordon <gordon@panix.com> - 2014-01-22 02:46 +0000
Re: Separate Address number and name Tim Chase <python.list@tim.thechases.com> - 2014-01-21 21:03 -0600
Re: Separate Address number and name Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-22 15:40 +0000
csiph-web