【发布时间】:2019-10-17 11:53:55
【问题描述】:
我有代码:
import matplotlib.pyplot as plt
from configparser import ConfigParser
cfg = ConfigParser()
cfg.read('file.cfg')
plt.plot([1, 10],[2, 2], color_4, ls = "dashed")
plt.xlim(1,10)
plt.ylim(1,4)
plt.savefig('image.pdf')
我想通过配置文件来控制它:
[a]
color_4 = c = 'silver'
请问有什么问题吗?它给出了一个错误:
NameError: name 'color_4' is not defined
【问题讨论】:
标签: python-3.x config configparser