• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            兔子的技術(shù)博客

            兔子

               :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
              202 Posts :: 0 Stories :: 43 Comments :: 0 Trackbacks

            留言簿(10)

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            比如有一個(gè)文件Userinfo.ini,里面有這些內(nèi)容:

            [userinfo]
            EngineVersion=0
            DATVersion=5127
            FileName=dat-5127.zip
            FilePath=/pub/antivirus/datfiles/4.x/
            FileSize=13481555
            Checksum=6037,021E
            MD5=aaeb519d3f276b810d46642d782d8921
            那就可以通過(guò)下面這些代碼得到MD5的值,簡(jiǎn)單吧
            #!/usr/bin/env python
            #
             -*- coding: utf-8 -*-

            import ConfigParser

            config 
            = ConfigParser.ConfigParser()
            config.readfp(open(
            'update.ini'))

            = config.get("ZIP","MD5")
            print a

            ××××××××××××××××××××××××××××××××××××××××××××××××
            寫也很簡(jiǎn)單:
            import ConfigParser

            config 
            = ConfigParser.ConfigParser()

            # set a number of parameters
            config.add_section("book")
            config.set(
            "book""title""the python standard library")
            config.set(
            "book""author""fredrik lundh")

            config.add_section(
            "ematter")
            config.set(
            "ematter""pages"250)

            # write to file
            config.write(open('1.ini'"w"))

            ×××××××××××××××××××××××××××××××××××××××××
            修改也不難(添加內(nèi)容):
            #!/usr/bin/env python
            #
             -*- coding: utf-8 -*-

            import ConfigParser

            config 
            = ConfigParser.ConfigParser()

            config.read(
            '1.ini')

            = config.add_section("md5")

            config.set(
            "md5""value""1234")

            config.write(open(
            '1.ini'"r+"))     #可以把r+改成其他方式,看看結(jié)果:)

            修改內(nèi)容:
            #!/usr/bin/env python
            #
             -*- coding: utf-8 -*-

            import ConfigParser

            config 
            = ConfigParser.ConfigParser()

            config.read(
            '1.ini')

            config.set(
            "md5""value""kingsoft")    #這樣md5就從1234變成kingsoft了

            config.write(open(
            '1.ini'"r+"))

            刪除部分(懶得寫了,自己看文檔):
            remove_option(section, option)
            Remove the specified option from the specified section. If the section does not exist, raise NoSectionError. If the option existed to be removed, return True; otherwise return False.New in version 1.6.

            remove_section(section)
            Remove the specified section from the configuration. If the section in fact existed, return True. Otherwise return False.
            posted on 2010-12-09 16:10 會(huì)飛的兔子 閱讀(645) 評(píng)論(0)  編輯 收藏 引用 所屬分類: C++庫(kù),組件
            国内精品伊人久久久久网站| 久久久午夜精品福利内容| 久久精品无码午夜福利理论片| 久久精品人人做人人爽电影蜜月| 狠狠色噜噜狠狠狠狠狠色综合久久| 久久精品国产欧美日韩| 麻豆精品久久久久久久99蜜桃 | 久久99国产综合精品免费| 久久国产乱子伦精品免费强| 久久久网中文字幕| 国产精品久久久久jk制服| 日韩电影久久久被窝网| 2022年国产精品久久久久| 亚洲国产成人久久笫一页| 久久se精品一区精品二区| 久久久久免费精品国产| 国产精品gz久久久| 国内精品久久久人妻中文字幕| 欧美麻豆久久久久久中文| 97久久精品国产精品青草| 狠狠色噜噜色狠狠狠综合久久| 狠狠精品久久久无码中文字幕 | 精品久久久久久99人妻| 日韩人妻无码一区二区三区久久 | 爱做久久久久久| 狠狠88综合久久久久综合网| 精品国产青草久久久久福利| 久久久久国产亚洲AV麻豆| 99久久综合国产精品二区| 久久精品国产亚洲网站| 精品国产VA久久久久久久冰 | 久久久国产一区二区三区| 久久久久久久综合日本亚洲| av无码久久久久不卡免费网站| 精品久久久中文字幕人妻| 精品国产乱码久久久久久呢| 久久亚洲熟女cc98cm| 欧美激情一区二区久久久| 久久99九九国产免费看小说| 超级碰碰碰碰97久久久久| A级毛片无码久久精品免费|