cfg.read('imooc.txt')一直報錯
usr/lib/python2.7/ConfigParser.pyc in read(self, filenames)
? ? 303 ? ? ? ? ? ? except IOError:
? ? 304 ? ? ? ? ? ? ? ? continue
--> 305 ? ? ? ? ? ? self._read(fp, filename)
? ? 306 ? ? ? ? ? ? fp.close()
? ? 307 ? ? ? ? ? ? read_ok.append(filename)
/usr/lib/python2.7/ConfigParser.pyc in _read(self, fp, fpname)
? ? 510 ? ? ? ? ? ? ? ? # no section header in the file?
? ? 511 ? ? ? ? ? ? ? ? elif cursect is None:
--> 512 ? ? ? ? ? ? ? ? ? ? raise MissingSectionHeaderError(fpname, lineno, line)
? ? 513 ? ? ? ? ? ? ? ? # an option line?
? ? 514 ? ? ? ? ? ? ? ? else:
MissingSectionHeaderError: File contains no section headers.
file: imooc.txt, line: 1
'123\xe6\x85\x95\xe8\xaf\xbe'
2018-06-29
你這imooc.txt 不是配置文件的格式, 你這個內容貌似是:"123幕課"哦