In <9fe1b47b-65ce-4063-9188-07b81cdba...@googlegroups.com> Shane Konings 
<shane.koni...@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


> FarmID        AddressNum    AddressName
> 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

> 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:])

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gor...@panix.com    watch 'House', or a real serial killer to watch 'Dexter'.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to