I have a .txt
file with this inside
Name: 321;
Score:100; Used Time: 1:09:308;
GTime: 6/28/2024 10:04:18 PM;
Core Version : 21.0.0.0;
Software Version : 21.0.0.0;
AppID: 0S0; MapDispName: Future City; MapName:MapName MapName MapName;
Key:A0000-abcde-Q0000-F0000-00H00; REG Date : 2/27/2021 1:16:34 PM; Expiry : 7/7/2024 12:00:00 AM
What I'm trying to do is convert that text into a .csv
(table) using a python script.
There are 300 files and hundreds of lines in each file. We only need to transform the information in the first 7 lines into csv. All of these 300 files have the same format but with different values.
What I would want the log.csv
file to show is:
Name,Sore,Time,Software Ver,Core Ver,AppID,Key,REG Date,Expiry,MapName
321,100,69.308s,21.0.0.0,21.0.0.0,0S0,A0000-abcde-Q0000-F0000-00H00,2/27/2021 1:16:34 PM,7/7/2024 12:00:00 AM,MapName MapName MapName
How can I do it with python? Thanks.
parse
the data. Such as:name, line = line.split(':', 1)
, thenscore, line = line.strip().split('\t')
– thethiny Feb 27 at 13:59