2024-04-25 12:32:33 发布
网友
我希望能够做这样的事情(Python3):
config = configparser.ConfigParser() config.read('http://example.com/myconfig.cfg')
在Python中通过HTTP读取配置文件的最佳方法是什么?如果有更好的选择,我不会嫁给configparser。在
configparser
您可以使用urllib2通过HTTP读取文件,并将config.readfp与之一起馈送。在
urllib2
config.readfp
import urllib2 config = configparser.ConfigParser() r = urllib2.urlopen("http://example.com/myconfig.cfg") config.readfp(r)
您可以使用
urllib2
通过HTTP读取文件,并将config.readfp
与之一起馈送。在相关问题 更多 >
编程相关推荐