>From the virtual desk of Lowell Tackett  


--- On Fri, 1/8/10, Kent Johnson <[email protected]> wrote:

> From: Kent Johnson <[email protected]>
> Subject: Re: [Tutor] manipulting CSV files
> To: "Lowell Tackett" <[email protected]>
> Cc: "tutor" <[email protected]>
> Date: Friday, January 8, 2010, 10:07 AM
> 
> Well, it's right - that is not a valid integer. What do you
> want to do
> with it? You could convert it to a number with
> float(line[2]) or get
> just the integer part with int(line[2].split('.')[0]).
> 
> Kent

Oh...

I hadn't grasped the subtle meaning of "int()"; thanks, that helps. So, here's 
the (happy) result:

>>> coord = csv.reader(open('true_coord', 'rb'), skipinitialspace = True)
>>> for line in coord:
....  if line[0] == '1001':
....   print [float(line[1]) + float(line[2])]
....
[1022313.8019999999]

Please keep in mind, as I'd mentioned earlier, all of this is fairly new 
concepts to me; from running an interpretive Python screen, to delving into the 
zen of computing, [even] to pasting stuff from there to here--there's about 4 
different "Learn Python and Make New Friends" books strewn around me and my 
computer desk right now, opened to different subjects (and the Joy of Google 
waiting on the internet) and with all that I want to develop to where I can 
create some pretty expansive scripts dealing with land surveying 
stuff--manipulating coordinates, inversing, traversing, bearings, etc., etc.

Ya'll are meeting me here pretty much on the proverbial "First Step" of the 
1000-mile journey, so all the help is very welcome and appreciated.  Thanks.

> 


      

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to