zoukankan      html  css  js  c++  java
  • python 学习

     1 import configparser #引入模块
     2 
     3 '''config = configparser.ConfigParser()    #类中一个方法 #实例化一个对象
     4 
     5 config["DEFAULT"] = {'ServerAliveInterval': '45',
     6                       'Compression': 'yes',
     7                      'CompressionLevel': '9',
     8                      'ForwardX11':'yes'
     9                      }    #类似于操作字典的形式
    10 
    11 config['bitbucket.org'] = {'User':'Atlan'} #类似于操作字典的形式
    12 
    13 config['topsecret.server.com'] = {'Host Port':'50022','ForwardX11':'no'}
    14 
    15 with open('example.ini', 'w') as configfile:
    16 
    17    config.write(configfile)    '''
    18 config=configparser.ConfigParser()
    19 config.read("example.ini")
    20 b=config.sections()
    21 c=config.defaults()
    22 d="bitbucket.org" in b
    23 #e=config[b[0]]["user"]
    24 e=config["bitbucket.org"]["user"]
    25 print(b)
    26 print(c)
    27 print(d)
    28 print(e)
    29 '''for key in config["bitbucket.org"]:
    30     print(key)'''
    31 for key2 in config:
    32     print(key2)
    33 '''
    34 config.remove_section("bitbucket.org")
    35 #config.write(open("example2.ini","w"))
    36 c=open("example.ini","w")
    37 config.write(c)'''
    38 
    39 config.set("topsecret.server.com","host port","aaaaa")
    40 
    41 
    42 config.remove_option("topsecret.server.com","host port")
    43 c=open("example.ini","w")
    44 config.write(c)
    View Code
  • 相关阅读:
    百度ECharts数据绑定诀窍
    SQL操作Json数据
    c# 如何得到一个字符的ASCII码
    Sql数据库收缩 语句特别快
    Hive中 使用 Round() 的坑
    [转]Hive 数据类型
    [转] Hive函数大全
    使用Hive Rest API 连接HDInsight
    Hive动态分区 参数配置及语法
    Js的引用赋值与传值赋值
  • 原文地址:https://www.cnblogs.com/wangbin2020/p/13081550.html
Copyright © 2011-2022 走看看