• <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++庫,組件
            精品乱码久久久久久夜夜嗨 | 久久久久久亚洲精品影院| 久久93精品国产91久久综合| 久久久久久亚洲精品不卡| 一本综合久久国产二区| 久久精品国产99久久无毒不卡| 欧美777精品久久久久网| 婷婷久久综合九色综合绿巨人| 综合网日日天干夜夜久久| 精品国产一区二区三区久久| 婷婷久久综合| 亚洲乱亚洲乱淫久久| 久久精品aⅴ无码中文字字幕不卡| 99麻豆久久久国产精品免费| 国产AⅤ精品一区二区三区久久| 亚洲国产一成久久精品国产成人综合| 久久精品欧美日韩精品| 久久久久久av无码免费看大片| 久久久久久九九99精品| 久久久久久伊人高潮影院| 国产巨作麻豆欧美亚洲综合久久| AV无码久久久久不卡蜜桃| 色播久久人人爽人人爽人人片aV | 国产成人精品久久一区二区三区av | 国产精品久久久亚洲| 久久精品国产亚洲av麻豆图片| 国产毛片久久久久久国产毛片| 国产精品一久久香蕉国产线看| 亚洲香蕉网久久综合影视| 久久久人妻精品无码一区| 久久99热这里只有精品国产| 日本免费一区二区久久人人澡| 亚洲国产精品无码久久久不卡| 久久人妻AV中文字幕| 国产精品久久久久a影院| 欧美激情精品久久久久久久九九九 | 久久99精品久久久久子伦| 无码国内精品久久人妻蜜桃| 无码人妻久久一区二区三区 | 色综合久久88色综合天天 | 久久综合狠狠综合久久97色|