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

python學習筆記之configparese

系統 1897 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元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!??!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 临高县| 石台县| 申扎县| 镇平县| 如东县| 铜陵市| 金华市| 姜堰市| 宝清县| 衡阳县| 繁昌县| 榆林市| 余庆县| 阳新县| 长海县| 南投县| 深圳市| 灵石县| 渑池县| 舟曲县| 临邑县| 大关县| 甘孜| 休宁县| 三明市| 谢通门县| 保德县| 淅川县| 信丰县| 洪雅县| 临夏市| 大姚县| 阿克苏市| 抚州市| 孟村| 宣化县| 手游| 汉阴县| 曲松县| 松滋市| 静乐县|