import  configparser

config = configparser.ConfigParser()
file = 'config.ini'
config.read(file)
config.add_section('login')
config.set('login','username','')
config.set('login','password','')
with open(file,'w') as configfile:
config.write(configfile) config = configparser.ConfigParser()
file = 'config.ini'
config.read(file)
username = config.get('login','username')
password = config.get('login','password')
print(username,password)

python3 ini文件读写的更多相关文章

  1. [IO] C# INI文件读写类与源码下载 (转载)

    /// <summary> /// 类说明:INI文件读写类. /// 编 码 人:苏飞 /// 联系方式:361983679 /// 更新网站:[url]http://www.sufei ...

  2. QSettings配置读写-win注册表操作-ini文件读写

    版权声明:若无来源注明,Techie亮博客文章均为原创. 转载请以链接形式标明本文标题和地址: 本文标题:QSettings配置读写-win注册表操作-ini文件读写     本文地址:http:// ...

  3. Python3:文件读写

    Python3:文件读写 open f = open('filename','r') # 读模式 f = open('filename','w') # 写模式 f = open('filename', ...

  4. C#对INI文件读写

    C#本身没有对INI格式文件的操作类,可以自定义一个IniFile类进行INI文件读写. using System; using System.Collections.Generic; using S ...

  5. 封装 INI 文件读写函数

    delphi读写ini文件实例 //--两个过程,主要实现:窗体关闭的时候,文件保存界面信息:窗体创建的时候,程序读取文件文件保存的信息. //--首先要uses IniFiles(单元) //--窗 ...

  6. C#实现.ini文件读写操作

    1.ini文件是什么?        见百度百科:https://baike.baidu.com/item/ini%E6%96%87%E4%BB%B6/9718973?fr=aladdin 2.C#语 ...

  7. VC++ 实现INI文件读写操作

    转载:https://blog.csdn.net/fan380485838/article/details/73188420 在实际项目开发中,会用ini配置文件,在此总结一下对ini读写操作 一:读 ...

  8. ini文件读写 保存上次存储内容

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  9. Delphi ini文件读写

    参考:http://www.cnblogs.com/zhangzhifeng/archive/2011/12/01/2270267.html 一.ini文件的结构 ;这是关于 ini 文件的注释 [节 ...

随机推荐

  1. WPF 通过名称查找属性(DependencyProperty)

    使用名称来查找DependencyProperty. 如果有这样的需求,则是需要通过DependencyPropertyDescriptor来查找. 通常是使用附加属性或者依赖属性的方法. 下面给出附 ...

  2. 快捷键-Visual Studio Code快捷键

    Shift+Enter 在Python终端中运行选定内容/行 C

  3. 05 .NET CORE 2.2 使用OCELOT -- NLog

    加入NLog 按照官网的文档 https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-2 一步一步操作下来,即可设置好. ...

  4. winfrom判断程序是否运行,并给提示

    在Program.cs文件中修改为: private static System.Threading.Mutex mutex; /// <summary> /// 应用程序的主入口点. / ...

  5. Linq 用得太随意导致的性能问题一则

    问题场景 有一个很多条数据的数据库(数据源),在其中找出指定的项,这些项的 ID 位于 给定的列表中,如 TargetList 中. private readonly IDictionary<s ...

  6. node+express修改代码会自动重新运行

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/weixin_40822305/artic ...

  7. cache介绍

    原帖地址: http://www.wowotech.net/memory_management/458.html?from=timeline 今天探究的主题是cache,我们围绕几个问题展开.为什么需 ...

  8. Java进程间通信学习

    转自:https://www.iteye.com/blog/polim-1278435 进程间通信的主要方法有:(1)管道(Pipe):管道可用于具有亲缘关系进程间的通信,允许一个进程和另一个与它有共 ...

  9. There is already an open DataReader associated with this Command which must be closed first

    通常出现在嵌套查询数据库(比如在一个qry的遍历时,又进行了数据库查询) 通过在连接字符串中允许MARS可以轻松解决这个问题. 将MultipleActiveResultSets = true添加到连 ...

  10. OSI、TCP/IP

    计算机网络分层的目的:支持异构网络系统的互联互通 7层OSI参考模型是法定标准(国际标准化组织ISO提出) 4层TCP/IP参考模型是事实标准 OSI参考模型 应用层.表示层.会话层.传输层.网络层. ...