I have this script of mine and it is for modifying some data I gather from GPS module. I run this code but it says there is a syntax error and I couldn't understand why there is an error, normally I use that bash command for parsing, can't it be used in a Python loop?
**
import serial
import struct
ser = serial.Serial("/dev/ttyUSB0", 4800, timeout = 1)
file = open("/home/pi/GPSWIFI.csv", "w")
file.write('\n')
for i in range(0,5):
val = ser.readline();
print >> file ,i,',',val
cat /home/pi/GPSWIFI.csv | grep GPGGA | cut -c19-42 >GPSWIFIMODIFIED.csv
file.close()
**
Thanks in advance.
shell=True. You might find this tutorial helpful.