Parse key value pairs in a text file

后端 未结 6 1309
無奈伤痛
無奈伤痛 2020-11-28 09:31

I am a newbie with Python and I search how to parse a .txt file. My .txt file is a namelist with computation informations like :

myfile.txt

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 10:12

    I personally solved this by creating a .py file that just contains all the parameters as variables - then did:

    include PARAMETERS.py
    

    in the program modules that need the parameters.

    It's a bit ugly, but VERY simple and easy to work with.

提交回复
热议问题