#! /usr/bin/python3 from gps import * import time gpsd = gps(mode=WATCH_ENABLE|WATCH_NEWSTYLE) print('latitude\tlongitude\ttime utc\t\taltitude\tepv\tept\tspeed\tclimb') # '\t' = TAB to try and output the data in columns. try: while True: report = gpsd.next() # if report['class'] == 'TPV': out = "" for i in ['lat','lon','time','alt','epv','ept','speed','climb']: out += str(getattr(report,i,0.0)) + "\t" print(out) time.sleep(1) except (KeyboardInterrupt, SystemExit): #when you press ctrl+c print("Done.\nExiting.")