Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python Parsin

Name: Anonymous 2012-01-30 6:54

Hey /prog/, How can I make this code look cleaner?

Code:        http://pastebin.com/YetPiWJa
Input:       http://pastebin.com/h8BgFYge
NEMA format: http://www.gpsinformation.org/dale/nmea.htm#nmea

Would censor out my info, but fuck it.

Name: Anonymous 2012-01-30 9:10

Something like this?
import sys
gpsFormat = lambda x, y: (lambda z: '%s.%s.%s%s' % (z[0][:-2], z[0][-2:], z[1], y))(x.split('.'))
if __name__ == "__main__":
    for line in (l2 for l2 in (l.split(',') for l in sys.stdin) if l2[0] == '$GPGLL'):
        print 'Lat: %s Long %s' % (gpsFormat(*line[1:3]), gpsFormat(*line[3:5]))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List