Parsing GPS receiver output via regex in Python

后端 未结 7 1306
没有蜡笔的小新
没有蜡笔的小新 2020-12-14 11:01

I have a friend who is finishing up his masters degree in aerospace engineering. For his final project, he is on a small team tasked with writing a program for tracking weat

7条回答
  •  执念已碎
    2020-12-14 11:46

    It's simpler to use split than a regex.

    >>> line="$GPRMC,092204.999,4250.5589,S,14718.5084,E,1,12,24.4,89.6,M,,,0000*1F "
    >>> line.split(',')
    ['$GPRMC', '092204.999', '4250.5589', 'S', '14718.5084', 'E', '1', '12', '24.4', '89.6', 'M', '', '', '0000*1F ']
    >>> 
    

提交回复
热议问题