• <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++庫,組件
            久久美女人爽女人爽| 大伊人青草狠狠久久| 久久久久久国产精品美女| 久久久亚洲精品蜜桃臀| 亚洲欧美日韩久久精品| 久久成人国产精品| 久久久久人妻精品一区三寸蜜桃| 欧美一级久久久久久久大片| 综合网日日天干夜夜久久| 亚洲成色999久久网站| 思思久久99热免费精品6| 精品久久久噜噜噜久久久| 久久久久国色AV免费看图片 | 久久96国产精品久久久| 狠狠精品干练久久久无码中文字幕 | 性做久久久久久久久| 国产精品久久网| 欧洲精品久久久av无码电影| 久久久久久久综合日本| 精品久久久久久中文字幕人妻最新| 久久精品国产黑森林| 伊人丁香狠狠色综合久久| 少妇内射兰兰久久| 国产精品久久久久a影院| 国产精品99久久久久久宅男| WWW婷婷AV久久久影片| 无码超乳爆乳中文字幕久久| 一本久久综合亚洲鲁鲁五月天| 国产精品免费久久久久电影网| 国产精品久久久久影院嫩草| 国产产无码乱码精品久久鸭| 久久久久久久久久久久中文字幕 | 狠狠色丁香久久综合五月| 狠狠综合久久综合88亚洲| 女人高潮久久久叫人喷水| 久久免费99精品国产自在现线 | 久久九九精品99国产精品| 久久精品国产亚洲AV不卡| 久久人人爽人人爽人人av东京热 | 久久久久波多野结衣高潮| 久久精品中文字幕一区|