• <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 會飛的兔子 閱讀(639) 評論(0)  編輯 收藏 引用 所屬分類: C++庫,組件
            亚洲精品国精品久久99热| 久久99国产乱子伦精品免费| 亚洲欧美国产日韩综合久久| 少妇人妻综合久久中文字幕| 欧美喷潮久久久XXXXx| 久久中文字幕一区二区| 亚洲国产精品无码久久九九| 久久亚洲精品国产精品| 久久久精品波多野结衣| 国产成人无码精品久久久性色| 亚洲国产精品婷婷久久| 久久无码AV一区二区三区| 亚洲一本综合久久| 午夜不卡久久精品无码免费| 青青国产成人久久91网 | 久久99亚洲综合精品首页| 一本色道久久综合狠狠躁篇| 日本久久久精品中文字幕| 欧洲人妻丰满av无码久久不卡| 久久精品国产亚洲Aⅴ香蕉| 久久久久久久亚洲Av无码| 伊人情人综合成人久久网小说| 99久久国产综合精品麻豆| 久久精品国产精品亚洲精品| 久久久噜噜噜久久| 91久久精品国产91性色也| 国内精品久久久久影院优| 久久精品中文无码资源站| 色综合久久中文字幕综合网| 精品久久国产一区二区三区香蕉| 久久亚洲精品成人AV| 久久久噜噜噜久久中文字幕色伊伊 | 久久久久久久久久久免费精品| AAA级久久久精品无码片| 亚洲国产欧美国产综合久久| 久久青青草原亚洲av无码| 久久不见久久见免费影院www日本| 久久综合中文字幕| www久久久天天com| 久久精品一区二区国产| 久久久久中文字幕|