第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

大家來(lái)找bug

import?os
import?os.path
import?ConfigParser
'''
1:?dump?ini
2:?del?section
3:?del?item
4:?modify?item
5:?add?section
6:?save?modify
'''

class?student_info(object):
????def?__init__(self,recordfile):
????????self.logfile?=?recordfile
????????self.cfg?=?ConfigParser.ConfigParser()

????def?cfg_load(self):
????????self.cfg.read(self.logfile)

????def?cfg_load(self):
????????self.cfg.read(self.logfile)

????def?cfg_dump(self):
????????se_list?=?self.cfg.section()
????????print?'=======================>'
????????for?se?in?cfg.section():
????????????print?se
????????????print?cfg.items(se)
????????????print?'======================='

????def?delete_item(self,section,key):
????????self.cfg.remove_option(section,key)

????def?delete_section(self,section):
????????self.cfg.remove_section(section)

????def?add_section(self,section):
????????self.cfg.add_section(section)

????def?set_item(self,section,key,value):
????????self.cfg.set(section,key,value)

????def?save(self):
????????fp?=?open(self.logfile,'w')
????????self.cfg.write(fp)
????????fp.close()

if?__name__?=?'__main__':
????info?=?student_info('imooc.txt')
????info.cfg_load()
????info.cfg_dump()
????info.set_item('userinfo','pwd','abc')
????info.cfg_dump()
????info.add_section('login')
????info.set_item('login','2016-10-20','20')
????info.cfg_dump()
????ingo.save()

這段代碼哪錯(cuò)了,老是報(bào)錯(cuò):

????def?delete_item(self,section,key):
????^
IndentationError:?unexpected?indent

縮進(jìn)肯定是4個(gè)空格沒(méi)錯(cuò)

正在回答

1 回答

???def?cfg_dump(self):
????????se_list?=?self.cfg.section()???#??se_list?=?self.cfg.sections()
????????print?'=======================>'
????????for?se?in?cfg.section():
????????????print?se
????????????print?cfg.items(se)????????#????????????print?self.cfg.items(se)
????????????print?'======================='
??
??第25行?section后面要加個(gè)s
??第29行?少了個(gè)self
??第49行??少了一個(gè)等于號(hào):if?__name__?=='__main__':?
??第58行??拼錯(cuò)了吧。?info.save()


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

大家來(lái)找bug

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)