• <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>

            兔子的技術博客

            兔子

               :: 首頁 :: 聯系 :: 聚合  :: 管理
              202 Posts :: 0 Stories :: 43 Comments :: 0 Trackbacks

            留言簿(10)

            最新評論

            閱讀排行榜

            評論排行榜

            比如有一個文件Userinfo.ini,里面有這些內容:

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

            import ConfigParser

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

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

            ××××××××××××××××××××××××××××××××××××××××××××××××
            寫也很簡單:
            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"))

            ×××××××××××××××××××××××××××××××××××××××××
            修改也不難(添加內容):
            #!/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+改成其他方式,看看結果:)

            修改內容:
            #!/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 會飛的兔子 閱讀(645) 評論(0)  編輯 收藏 引用 所屬分類: C++庫,組件
            久久精品?ⅴ无码中文字幕| 波多野结衣久久一区二区| 久久久久亚洲AV成人网| 久久久久国产| 99久久精品免费看国产一区二区三区 | 久久99热这里只频精品6| 日韩av无码久久精品免费| 漂亮人妻被中出中文字幕久久 | 无码乱码观看精品久久| 国产农村妇女毛片精品久久| 国内精品久久久久伊人av| 久久婷婷五月综合国产尤物app| 久久99精品综合国产首页| 久久99国产精一区二区三区| 精品久久久久久无码不卡| 99热都是精品久久久久久| 国产成人无码久久久精品一| 日批日出水久久亚洲精品tv| 91久久精品国产免费直播| 国内精品久久久久久久涩爱| 精品人妻伦九区久久AAA片69| 日产精品久久久久久久| 久久九九兔免费精品6| 区久久AAA片69亚洲| 久久久久亚洲av毛片大| 狠狠色伊人久久精品综合网| 国产精品gz久久久| 国产精品VIDEOSSEX久久发布| 久久精品麻豆日日躁夜夜躁| 久久精品国产精品国产精品污| 欧洲精品久久久av无码电影 | 少妇被又大又粗又爽毛片久久黑人 | 亚洲AV无码久久精品成人 | 青青草国产成人久久91网| 看全色黄大色大片免费久久久| 日本一区精品久久久久影院| 久久精品男人影院| 欧美久久综合性欧美| 精品人妻伦九区久久AAA片69| 国产精品欧美亚洲韩国日本久久| 亚洲一区二区三区日本久久九|