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


Groups > comp.lang.python > #64627

Re: Separate Address number and name

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.python
Subject Re: Separate Address number and name
Date 2014-01-23 18:11 +0000
Organization A noiseless patient Spider
Message-ID <lbrm0h$dl1$2@dont-email.me> (permalink)
References <9fe1b47b-65ce-4063-9188-07b81cdba49f@googlegroups.com> <a218f6ef-37c1-4eaf-a127-5ea4846cb332@googlegroups.com> <lbovgq$668$4@dont-email.me>

Show all headers | View raw


On Wed, 22 Jan 2014 17:35:22 +0000, Denis McMahon wrote:

> On Tue, 21 Jan 2014 16:06:56 -0800, Shane Konings wrote:

>> The following is a sample of the data.

> A mechanism using regexes

Just to follow up, using regexes I transformed the sample data that I 
believe is as follows:

inputData = [
"1	1067 Niagara Stone Rd, W, Niagara-On-The-Lake, ON L0S 1J0",
"2	4260 Mountainview Rd, Lincoln, ON L0R 1B2",
"3	25 Hunter Rd, Grimsby, E, ON L3M 4A3",
"4	1091 Hutchinson Rd, Haldimand, ON N0A 1K0",
"5	5172 Green Lane Rd, Lincoln, ON L0R 1B3",
"6	500 Glenridge Ave, East, St. Catharines, ON L2S 3A1",
"7	471 Foss Rd, Pelham, ON L0S 1C0",
"8	758 Niagara Stone Rd, Niagara-On-The-Lake, ON L0S 1J0",
"9	3836 Main St, North, Lincoln, ON L0R 1S0",
"10	1025 York Rd, W, Niagara-On-The-Lake, ON L0S 1P0"
]

Into the following:

1,1067,Niagara Stone,Rd,W,Niagara-On-The-Lake,ON,L0S 1J0
2,4260,Mountainview,Rd,,Lincoln,ON,L0R 1B2
3,25,Hunter,Rd,Grimsby,E,ON,L3M 4A3
4,1091,Hutchinson,Rd,,Haldimand,ON,N0A 1K0
5,5172,Green Lane,Rd,,Lincoln,ON,L0R 1B3
6,500,Glenridge,Ave,East,St. Catharines,ON,L2S 3A1
7,471,Foss,Rd,,Pelham,ON,L0S 1C0
8,758,Niagara Stone,Rd,,Niagara-On-The-Lake,ON,L0S 1J0
9,3836,Main,St,North,Lincoln,ON,L0R 1S0
10,1025,York,Rd,W,Niagara-On-The-Lake,ON,L0S 1P0

Which should then read into Excel as CSV just fine.

One final question though, why are you using excel to manipulate data 
that looks as if it would be better held in and manipulated by a database?

-- 
Denis McMahon, denismfmcmahon@gmail.com

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


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