我有一個日誌文件(稱爲preprocstats.log),我想知道如何使用Python 2.6將其解析爲JSON格式文件。如何解析日誌文件到JSON
日誌文件的輸入是:
Preprocessor Profile Statistics (all)
==========================================================
Num Preprocessor Layer Checks Exits
=== ============ ===== ====== =====
1 httpinspect 0 1 1
2 detect 0 33 33
... (and more rows)
,我想這與該輸出解析到JSON,例如:
{"Num": 1, "Preprocessor": "httpinspect", "Layer": 0, "Checks": 1, "Exits": 1}
{"Num": 2, "Preprocessor": "detect", "Layer": 0, "Checks": 33, "Exits": 33}
... (and the rest of rows)
SO既不是代碼編寫,也不教程服務。 – jonrsharpe
我知道,你能寄給我一些幫助我做這件事的文件嗎?或告訴我能讀什麼..我搜索了很多東西,但它不幫助我.. – fornikador
請求查找異地教程和文檔也是脫離主題,請參見[問]。 – jonrsharpe