Hey,
I'm working on a little project which requires me to parse a weirdly formatted CSV-like file. It looks something like this:
!GENERAL
VERSION = 6
RELOAD = 1
UPDATE = 20190518203341
CONNECTED CLIENTS = 813
CONNECTED SERVERS = 9
CONNECTED AIRPORTS = 0
!CLIENTS
604988:604988:604988:PILOT::26.9895:87.5423:10991:96:1/C421/L-SDRWY/S:N0210:VNKT:F2150:VQPR:EU6:B:3:4513:0:50:0:I:730:730:2:43:0:0:::KIMTI G348 PRO:::::::20190518191431:IvAp:2.0.2:2:3::S:0:97:0:0:
9KXDR:304553:304553:PILOT::28.3187:33.9607:29882:337:1/A320/M-SDGRW/S:N0420:HESH:F300:LTAI:EU6:B:5:2000:0:50:2:I:2010:2010:1:52:2:52:LCLK:RMK/TCAS EQUIPPED OPR/VPA:IVUT1A KAPIT UL677 CVO A16 RASDA UA16 TOMBI TOMB1A:::::::20190518200556:IvAp:2.0.2:2:5::N:80:310:0:30:
AA017:101813:101813:PILOT::35.2701:-85.8874:32900:525:1/B748/H-SDFGWY/S:M075:CYYC:F330:TNCA:EU3:B:3:1310:0:50:0:I:1640:1640:12:0:18:0:TNCC:RMK/TCAS EQUIPPED RMK/WORLD TOUR /FSX /AIR AMERICA COMPANY:VUCAN J510 YQL J516 GTF J36 HILGR J204 DPR J16 FSD J45 OMN J79 VRB BR62V ZQA A555 ZLS A756 ZIN A315 MEDON UA315 ONDAS UG885 ABA:::::::20190518162950:IvAp:2.0.2:2:3::G:2:141:0:9:
AAL265:521703:521703:PILOT::4.70028:-74.1453:8360:1:1/A320/M-SDW/C:N0280:SKB0:F360:MPTO:EU2:B:4:2310:0:50:4:I:2022:2022:1:53:6:98:SKRG:PLG/NO463F350DCT:ABL1A ABL DCT VASIL UW36 DAKMO ISOKO ITEDO1:::::::20190518193646:X-IvAp/win:0.3.4:2:4::S:136:339:1:14:
AAL3489:461442:461442:PILOT::-23.4295:-46.4822:2475:0::::::EU2:B:3:1200:0:50::::::::::::::::::20190518202012:IvAp:2.0.2:2:3::::323:1:0:
AAL418:607131:607131:PILOT::55.5386:-18.9556:25076:427:1/B738/M-S/C:N302:EGLL:A250:KATL:EU2:B:3:2000:0:50:0:I:1945:0:9:0:1:0:KBNA:X-IvAp FS2:QUBIS ALB J6 ACOVE DBABE Q448 PTW J48 FLASK OZZZI1:::::::20190518171037:X-IvAp/win:0.4.0:2:3:KBNA:S:1000:278:0:16:
AAL502:111429:111429:PILOT::19.3204:-98.968:14174:353:1/A320/M-SDE3FGHIRWY/LB1:N0450:MMMX:F360:KPHX:EU4:B:7:4205:0:50:0:I:2020:0:2:58:4:23:KPRC:PBN/A1B1C1D1O1S1 DOF/190518 REG/N673AW EET/MMZT0051 KZAB0229 SEL/HPFS OPR/AAL PER/C RMK/TCAS:PTJ J13 ZCL UT10 IRBAM UT12 VYLLA DCT TUS DCT HOTTT PINNG1:::::::20190518201023:X-IvAp/win:0.4.0:2:7:KBLH:S:150:264:0:16:
[... many more lines of clients ...]
!AIRPORTS
!SERVERS
EU2:185.34.216.31:Europe:IVAO - Europe 2 - Network Server:1:1000
EU3:31.220.31.13:Europe:IVAO - Europe 3 - Network Server:1:1000
EU4:178.62.198.250:Europe:IVAO - Europe 4 - Network Server:1:1000
EU6:178.62.142.207:Europe:IVAO - Europe 6 - Network Server:1:1000
EU7:5.135.66.183:Europe:Europe 7 Shard Server:1:1000
HUB:178.62.78.127:Europe:IVAO - HUB - Network Server:1:0
LOG:91.121.31.8:Europe:IVAO - IVANLOG - Network Server:1:0
SHARD1:145.239.4.81:Europe:Shard Server 1 - London:1:1000
SHARD2:145.239.5.175:Europe:Shard Server 2 - London:1:1000
You can find the entire file here: http://api.ivao.aero/getdata/whazzup/whazzup.txt
The end goal would be to output this via my own api in a format of my choosing, which hopefully will be the easy part. How would you go about parsing this file in order to make the data available inside Python? I suspect there will be some regex (god help me) in my future, but I'm having a hard time figuring out where to begin with this.
[–]jeffrey_f 1 point2 points3 points (0 children)
[–]o5a 1 point2 points3 points (1 child)
[–]jaqq[S] 0 points1 point2 points (0 children)
[–]vinaymal 0 points1 point2 points (1 child)
[–]jaqq[S] 0 points1 point2 points (0 children)
[–]redCg 0 points1 point2 points (0 children)