• <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++庫,組件
            久久夜色精品国产亚洲| 丁香五月综合久久激情| 看久久久久久a级毛片| 久久精品亚洲中文字幕无码麻豆 | 久久久久亚洲精品无码网址 | 精品国产福利久久久| 久久久久亚洲精品中文字幕| 久久亚洲AV成人无码软件 | 久久久久女教师免费一区| 久久亚洲AV无码精品色午夜 | 久久久精品视频免费观看| 久久久久久久波多野结衣高潮| 99久久无色码中文字幕| 亚洲精品tv久久久久久久久久| 久久人妻少妇嫩草AV无码专区 | 久久久久香蕉视频| 97久久超碰国产精品2021| 久久久久久国产精品美女| 欧美日韩中文字幕久久伊人| 亚洲狠狠婷婷综合久久蜜芽 | 久久这里只精品99re66| 亚洲乱亚洲乱淫久久| 午夜天堂av天堂久久久| 中文字幕无码久久人妻| 久久精品成人免费国产片小草| 午夜不卡久久精品无码免费| 亚洲第一永久AV网站久久精品男人的天堂AV | 无码人妻精品一区二区三区久久| 久久久久香蕉视频| 久久精品无码一区二区app| 伊人久久综合热线大杳蕉下载| 99久久免费国产精精品| 97久久精品无码一区二区天美| 人妻精品久久久久中文字幕一冢本| 国产精品中文久久久久久久| 天天影视色香欲综合久久| 久久伊人精品青青草原日本| 日韩欧美亚洲综合久久影院Ds | 久久久噜噜噜久久中文字幕色伊伊| 国产精品9999久久久久| 91精品国产高清久久久久久io|