Re: [Tutor] An interesting case... of east vs. west

2007-07-11 Thread Albert Weiss
PM To tutor@python.org cc Subject [Tutor] An interesting case... of east vs. west I was trying to read in a tab delimited file i was given with lat and lon, the thing is I needed decimal lat, and decimal long... well, anyway I think you can see what my problem was: for i in range(0,344)

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
I will work with this further, and report back once I find Alan's method... but for now, this seems to work: for i in range(0,20): y=d[i][2].split('\xb0') x=d[i][3].split('\xb0') ydeg,ymin=int(y[0].rstrip()),float(y[1].strip('\' N')) xdeg,xmin=int(x[0].rstrip()),float(x[1].rstrip("\' E").rstrip("

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote > you can see what my problem was: > > for i in range(0,344) > y=d[i][2].split('\xb0') > x=d[i][3].split('\xb0') > ... > declon=int(xdeg)+(float(xmin)/60) The first thing I'd suggest is not to try to do it all in one step. Break it into chunks and wri

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
A little closer, this seems to work, but it's not catching the 'W' or 'S' cases to make it negative... for i in range(0,20): y=d[i][2].split('\xb0') x=d[i][3].split('\xb0') ydeg,ymin=int(y[0].rstrip()),float(y[1].strip('\' N')) xdeg,xmin=int(x[0].rstrip()),float(x[1].rstrip("\' E").rstrip

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread Tino Dai
On 7/10/07, John <[EMAIL PROTECTED]> wrote: I was trying to read in a tab delimited file i was given with lat and lon, the thing is I needed decimal lat, and decimal long... well, anyway I think you can see what my problem was: for i in range(0,344) y=d[i][2].split('\xb0') x=d[i][3].spli

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
ECTED]>* Sent by: [EMAIL PROTECTED] 07/10/2007 04:22 PM To tutor@python.org cc Subject [Tutor] An interesting case... of east vs. west I was trying to read in a tab delimited file i was given with lat and lon, the thing is I needed decimal lat, and decimal long... well, anyway I think you

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread Luke Paireepinart
John wrote: > Just a quick follow up.. it doesn't work :s > > There are definitely some problems... ideas are welcome! I have an idea: use a regular expression :D Unfortunately, I don't have the knowledge of these down well enough to just spout one off OTOH, and I've got somewhere I have to be,

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
Just a quick follow up.. it doesn't work :s There are definitely some problems... ideas are welcome! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
I was trying to read in a tab delimited file i was given with lat and lon, the thing is I needed decimal lat, and decimal long... well, anyway I think you can see what my problem was: for i in range(0,344) y=d[i][2].split('\xb0') x=d[i][3].split('\xb0') ydeg,ymin=y[0].strip(),y[1].rstrip(