Processing repeatedly structured text file with python

后端 未结 3 429
有刺的猬
有刺的猬 2020-12-10 09:45

I have a big text file structured in blocks like:

Student = {
        PInfo = {
                ID   = 0001;
            Name.First = \"Joe\";
            Na         


        
3条回答
  •  一整个雨季
    2020-12-10 10:25

    it's not json, but similar structured. you should be able to reformat it into json.

    1. "=" -> ":"
    2. quote all keys with '"'
    3. ";" -> ","
    4. remove all "," which are followed by a "}"
    5. put it in curly braces
    6. parse it with json.loads

提交回复
热议问题