I am trying to get the longtitude, latitude and altitude from a GPS module on my Raspberry Pi B+.
Currently running this code here:
## Prints the latitude and longitude every second.
import time
import microstacknode.hardware.gps.l80gps
if __name__ == '__main__':
gps = microstacknode.hardware.gps.l80gps.L80GPS()
while True:
try:
data = gps.get_gpgga()
except microstacknode.hardware.gps.l80gps.NMEAPacketNotFoundError:
continue
List = [list(data.values())[x] for x in [7, 9, 12]]
string=str(List)
string = string[1:-1]
text_file = open("/home/pi/fyp/gps.txt","a")
text_file.write(string + "\n")
time.sleep(1)
This is the output of said code:
0.0, 0.0, '10.2'
0.0, 0.0, '3.2'
0.0, 0.0, '10.1'
0.0, 0.0, '3.1'
0.0, 0.0, '4.5'
0.0, 0.0, '20.1'
0.0, 0.0, '3583.1232'
0.0, 0.0, '102.01'
0.0, 0.0, '32.131'
0.0, 0.0, '421.32'
0.0, 0.0, '12391.11'
0.0, 0.0, '323.411'
Is it possible to remove the '' quotes in the last section of the output and leave just the number like in the first two sections of the output?