• <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ù),組件
            久久精品国产色蜜蜜麻豆| 欧美日韩精品久久久久| 91精品国产91热久久久久福利| 久久中文字幕精品| 九九久久精品国产| 国内精品久久久久国产盗摄| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 久久久av波多野一区二区| 日韩欧美亚洲综合久久| 亚洲国产成人精品女人久久久| 久久精品人人做人人爽电影| 无码国内精品久久综合88 | 国产亚州精品女人久久久久久| 亚洲欧美久久久久9999| 亚洲综合久久综合激情久久| 一本色综合网久久| 久久久久亚洲AV片无码下载蜜桃 | 亚洲AⅤ优女AV综合久久久| 久久久久99精品成人片试看 | 91精品国产综合久久香蕉| 久久午夜羞羞影院免费观看| 久久久久久午夜成人影院| 久久天天躁狠狠躁夜夜2020老熟妇| 久久综合给合综合久久| 久久久久四虎国产精品| 久久精品国产精品亚洲下载| 久久狠狠色狠狠色综合| 久久久免费观成人影院| 国产欧美一区二区久久| 久久久精品国产sm调教网站| 亚洲国产精品无码久久久秋霞2| 国产精品99久久免费观看| 国产精品99久久精品爆乳| 亚洲а∨天堂久久精品9966| 大香网伊人久久综合网2020| 2021国产成人精品久久| 嫩草影院久久99| 亚洲国产精品热久久| 国产精品成人99久久久久 | 99久久人人爽亚洲精品美女| 久久综合久久综合久久|