Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64467
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.023 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'string': 0.09; 'character,': 0.09; 'foss': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:number': 0.09; '*always*': 0.16; '107': 0.16; 'finney': 0.16; 'headings': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'split': 0.19; 'examples': 0.20; '>>>': 0.22; 'separate': 0.22; 'header:User-Agent:1': 0.23; "i've": 0.25; 'header:X-Complaints- To:1': 0.27; 'writes:': 0.31; 'york': 0.35; 'but': 0.35; 'received:com.au': 0.36; 'unit': 0.37; 'ben': 0.38; 'to:addr :python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'space': 0.40; 'first': 0.61; 'address': 0.63; 'name': 0.63; 'road': 0.65; 'life': 0.66; 'sample': 0.67; '500': 0.70; 'below.': 0.71; 'hunter': 0.84; 'hutchinson': 0.84; 'received:125': 0.84; 'stone': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Ben Finney <ben+python@benfinney.id.au> |
| Subject | Re: Separate Address number and name |
| Date | Wed, 22 Jan 2014 11:08:08 +1100 |
| References | <9fe1b47b-65ce-4063-9188-07b81cdba49f@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | vmx15867.hosting24.com.au |
| X-Public-Key-ID | 0xBD41714B |
| X-Public-Key-Fingerprint | 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-gpg.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
| Cancel-Lock | sha1:G/XJ//KMPcAySOUlIvMPUZRNC64= |
| 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.5826.1390349308.18130.python-list@python.org> (permalink) |
| Lines | 43 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1390349308 news.xs4all.nl 2868 [2001:888:2000:d::a6]:36317 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:64467 |
Show key headers only | View raw
Shane Konings <shane.konings@gmail.com> writes:
> I have the following sample from a data set and I am looking to split
> the address number and name into separate headings as seen below.
>
> FarmID Address
> 1 1067 Niagara Stone
> 2 4260 Mountainview
> 3 25 Hunter
> 4 1091 Hutchinson
> 5 5172 Green Lane
> 6 500 Glenridge
> 7 471 Foss
> 8 758 Niagara Stone
> 9 3836 Main
> 10 1025 York
If it is *always* the case that you just want to split the string on the
first space (' ', U+0020) character, then this will do the job:
>>> street_address = "1067 Niagara Stone"
>>> (street_number, street_name) = street_address.split(' ', 1)
>>> street_number
'1067'
>>> street_name
'Niagara Stone'
But that's a very dubious assumption. Are you sure your data contains no
examples like:
PO Box 27
Unit 6, 52 Watford Avenue
Lot D property 107 Sandusky Road
etc.? What is your policy for dealing with data which isn't structured
as you assume?
--
\ “All my life I've had one dream: to achieve my many goals.” |
`\ —Homer, _The Simpsons_ |
_o__) |
Ben Finney
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