Unwanted Spaces and Iterative Loop

2014-01-26 Thread matt . s . marotta
I have been working on a python script that separates mailing addresses into different components. Here is my code: inFile = "directory" outFile = "directory" inHandler = open(inFile, 'r') outHandler = open(outFile, 'w') outHandler.write("FarmID\tAddress\tStreetNum\tStreetName\tSufType\tDir\tCi

Re: Unwanted Spaces and Iterative Loop

2014-01-26 Thread matt . s . marotta
On Sunday, 26 January 2014 18:44:16 UTC-5, Jason Friedman wrote: > outHandler.write("FarmID\tAddress\tStreetNum\tStreetName\tSufType\tDir\tCity\tProvince\tPostalCode") > > > > ... >   > FarmID  Address > > 1       1067 Niagara Stone Rd, Niagara-On-The-Lake, ON L0S 1J0 > > 2       4260 Mountai

Re: Unwanted Spaces and Iterative Loop

2014-01-26 Thread matt . s . marotta
On Sunday, 26 January 2014 19:40:26 UTC-5, Steven D'Aprano wrote: > On Sun, 26 Jan 2014 13:46:21 -0800, matt.s.marotta wrote: > > > > > I have been working on a python script that separates mailing addresses > > > into different components. > > > > > > Here is my code: > > > > > > inFile

Re: Unwanted Spaces and Iterative Loop

2014-01-26 Thread matt . s . marotta
On Sunday, 26 January 2014 20:56:01 UTC-5, Chris Angelico wrote: > On Mon, Jan 27, 2014 at 12:15 PM, wrote: > > > I`m not reading and writing to the same file, I just changed the actual > > paths to directory. > > > > For next time, say "directory1" and "directory2" to preserve the fact >

Re: Unwanted Spaces and Iterative Loop

2014-01-26 Thread matt . s . marotta
On Sunday, 26 January 2014 21:00:35 UTC-5, Jason Friedman wrote: > I`m not reading and writing to the same file, I just changed the actual paths > to directory. > > > > This is for a school assignment, and we haven`t been taught any of the stuff > you`re talking about.  Although I appreciate

Remove unwanted characters from column

2014-01-26 Thread matt . s . marotta
School assignment is to create a tab separated output with the original given addresses in one column and then the addresses split into other columns (ex, columns for city, postal code, street suffix). Here is my code: inHandler = open(inFile, 'r') outHandler = open(outFile, 'w') outHandler.wri

Re: Remove unwanted characters from column

2014-01-27 Thread matt . s . marotta
On Monday, 27 January 2014 00:24:11 UTC-5, Dave Angel wrote: > matt.s.maro...@gmail.com Wrote in message: > > > School assignment is to create a tab separated output with the original > > given addresses in one column and then the addresses split into other > > columns (ex, columns for city, po

Re: Remove unwanted characters from column

2014-01-27 Thread matt . s . marotta
On Monday, 27 January 2014 08:54:20 UTC-5, Steven D'Aprano wrote: > On Mon, 27 Jan 2014 05:32:08 -0800, matt.s.marotta wrote: > > > > > The code that I used is the proper way that we were supposed to complete > > > the assignment. All I need now is an 'if...then' statement to get rid > > > o

Re: Remove unwanted characters from column

2014-01-27 Thread matt . s . marotta
On Monday, 27 January 2014 09:57:32 UTC-5, Chris Angelico wrote: > On Tue, Jan 28, 2014 at 1:23 AM, 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