python configparser
模块可以生成.ini文件,如下所示:
sample (this entire line written to outfiles)
other comments (this entire line discarded)
IOFILES Keyword, don't edit this line
tset.txt Name of input meteorological data file
test Prefix for output file
CONTROL Keyword, don't edit this line
1 (int) Number of header lines in input file
11680 (int) Number of days of data in input file
PARAMETERS Keyword, don't edit this line
500.0 (double) Base station elevation, meters
50.0 (double) Base station annual precip isohyet, cm
48.0 (double) Site latitude, degrees (- for south)
END Keyword, don't edit this line
所有参数值都设置了flush,并使用space来分隔valuse和参数插图。
我将构建许多像上面用作.exe程序参数设置的ini文件。不同的ini文件具有不同的参数,但可以通过循环生成。还有其他方法可以实现吗?