Last active
January 21, 2019 03:51
-
-
Save su27/a3bd23f82ed85e9c07f5e89912f4296c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def main(): | |
f = open('game_log.tsv', encoding='utf-8') | |
wf = open('game_log_new.csv', 'w', encoding='utf-8') | |
for i, l in enumerate(f.readlines()): | |
if i == 0: | |
wf.write('event_time,event_lat,event_lng,tracker_trigger,comments\n') | |
else: | |
l = l.replace('None', '') | |
data = l.strip().split('\t') | |
data[0] = data[0].replace(' ', '-', 1) | |
wf.write('%s\n' % ','.join(data)) | |
wf.close() | |
f.close() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@LeoQuote 竟然有编码问题,没试Windows,捂脸。。