Dat*_*ted 3 python configuration configuration-files configparser python-2.7
我正在使用 configparser 来自动读取和修改名为“streamer.conf”的文件 conf。我正在这样做:
import configparser
config = configparser.ConfigParser()
config.read('C:/Users/../Desktop/streamer.conf')
Run Code Online (Sandbox Code Playgroud)
然后它与此错误消息分开:
MissingSectionHeaderError: File contains no section headers.
file: 'C:/Users/../Desktop/streamer.conf', line: 1
u'input{\n'
Run Code Online (Sandbox Code Playgroud)
可能有什么问题?任何帮助表示赞赏。
只需指定正确的编码
config.read(config_file_path, encoding='utf-8-sig')
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
20384 次 |
最近记录: |