一个可以被python和shell读取的配置文件

Jim*_*mmy 6 python bash shell configuration debian

我在同一文件夹中有python脚本和shell脚本,它们都需要配置.我目前有一个用于我的python脚本的config.py,但我想知道是否有可能有一个配置文件,可以很容易地读取python脚本和shell脚本.

任何人都可以给出一个最适合python和shell读取的配置文件格式的例子.

Gil*_*not 6

我认为最简单的解决方案是:

key1="value1"
key2="value2"
key3="value3"
Run Code Online (Sandbox Code Playgroud)

你只需要获取这个env文件,在Python中,它很容易解析.

周围不允许有空间 =

对于Python,请参阅以下文章:在Python中模拟Bash'source'