• <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++庫,組件
            国产99久久精品一区二区| 久久久久久久91精品免费观看| 亚洲欧美日韩久久精品| 国产精品久久久香蕉| 狼狼综合久久久久综合网| 欧美精品一区二区精品久久| 色天使久久综合网天天| 日韩人妻无码精品久久免费一| 97久久香蕉国产线看观看| 久久99热这里只有精品66| 热re99久久精品国产99热| 久久婷婷五月综合国产尤物app| 狠狠色丁香婷综合久久| 久久综合久久美利坚合众国| 亚洲国产成人久久精品影视| 麻豆亚洲AV永久无码精品久久| 久久久人妻精品无码一区| 97久久精品国产精品青草| 精品一二三区久久aaa片| 欧美伊人久久大香线蕉综合69 | 亚洲色大成网站www久久九| 99久久精品免费看国产一区二区三区 | 国产亚洲精久久久久久无码| 欧美激情一区二区久久久| 久久久久99精品成人片三人毛片 | 国产激情久久久久影院小草| 国产精品无码久久综合| 久久久无码精品亚洲日韩京东传媒| 精品久久久久中文字幕一区| 久久九九全国免费| 精品国产福利久久久| 久久不射电影网| 久久久综合九色合综国产| 精品精品国产自在久久高清| 成人久久精品一区二区三区| 国产精品久久久久影院嫩草| 99久久精品午夜一区二区| 久久91精品久久91综合| 丰满少妇人妻久久久久久4| 久久久久久亚洲精品不卡| 久久久99精品成人片中文字幕|