资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

configparser.ConfigParser.writer()-创新互联

①
   write(fileobject, space_around_delimiters=True)

Write a representation of the configuration to the specified file object,which must be opened in text mode(accepting strings),This representation can ba parsed by a future read() call.if space_around_delimiters is true,delimiters between keys an values are surrounded by spaces.

创新互联专注于兰陵网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供兰陵营销型网站建设,兰陵网站制作、兰陵网页设计、兰陵网站官网定制、成都微信小程序服务,打造兰陵网络公司原创品牌,更为您提供兰陵网站排名全网营销落地服务。

config = configparser.Configparser()
must be opened in text mode (accept strings):只能使用text模式打开的文件才能被写入,with open('users.pkl', 'w') as f:
config.writer(f)

②
read(filenames, encoding=None)
            If filenames is a string or path-like object, it is treated as a single filename. If a file named in filenames cannot be opened, that file will be ignored. This is designed so that you can specify a list of potential configuration file locations (for example, the current directory, the user’s home directory, and some system-wide directory), and all existing configuration files in the list will be read.

If none of the named files exist, the ConfigParser instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using read_file() before calling read() for any optional files:

import configparser, os

config = configparser.ConfigParser()
config.read_file(open('defaults.cfg'))

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前名称:configparser.ConfigParser.writer()-创新互联
转载注明:http://cdkjz.cn/article/dsddpi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220