日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

python學習筆記之configparese

系統 2004 0
          configparse
          
# import configparser
# config = configparser.ConfigParser()
# config["DEFAULT"] = {'ServerAliveInterval': '45',
# 'Compression': 'yes',
# 'CompressionLevel': '9',
# 'ForwardX11':'yes'
# }
# config['bitbucket.org'] = {'User':'hg'}
#
# config['topsecret.server.com'] = {'Host Port':'50022','ForwardX11':'no'}
#
# with open('example.ini', 'w') as f:
# config.write(f)


# import configparser
#
# config = configparser.ConfigParser()
# #---------------------------查找文件內容,基于字典的形式
# # print(config.sections()) # []
#
# config.read('example.ini')
# print(config.sections()) # ['bitbucket.org', 'topsecret.server.com']
#
# print('bytebong.com' in config) # False
# print('bitbucket.org' in config) # True

# print(config['bitbucket.org']["user"]) # hg
# print(config['DEFAULT']['Compression']) #yes
# print(config['topsecret.server.com']['ForwardX11']) #no
#
# print(config['bitbucket.org']) #
#
# for key in config['bitbucket.org']: # 注意,有default會默認default的鍵
# print(key)
#
# print(config.options('bitbucket.org')) # 同for循環,找到'bitbucket.org'下所有鍵
#
# print(config.items('bitbucket.org')) #找到'bitbucket.org'下所有鍵值對
#
# print(config.get('bitbucket.org','compression')) # yes get方法Section下的key對應的value

# import configparser
# config = configparser.ConfigParser()
# config.read('example.ini') # 讀文件
# config.iniadd_section('yuan') # 增加section
# config.remove_section('bitbucket.org') # 刪除一個section
# config.remove_option('topsecret.server.com',"forwardx11") # 刪除一個配置項
#config.set('topsecret.server.com','k1','11111')
# config.set('yuan','k2','22222')
# f = open('new2.ini', "w")
# config.write(f) # 寫進文件
# f.close()

更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。。?/p>

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 东方市| 平泉县| 曲靖市| 仁布县| 房产| 龙川县| 卓资县| 德化县| 莎车县| 东方市| 瑞昌市| 平谷区| 汽车| 大同县| 桓仁| 麦盖提县| 囊谦县| 桐梓县| 兴仁县| 巴彦淖尔市| 峨眉山市| 崇信县| 清镇市| 交口县| 陕西省| 青岛市| 博野县| 勃利县| 永登县| 阿城市| 台山市| 白朗县| 墨玉县| 盖州市| 右玉县| 察哈| 蚌埠市| 宁国市| 休宁县| 晋中市| 武定县|