摘要:
一、读取配置文件(config.ini) read(filname):读取文件内容 section():获取所有section,返回list options(section):获取该section所有options,返回list items(section):获取options键值对,返回list 阅读全文
posted @ 2020-03-17 16:18
哔仙女
阅读(911)
评论(0)
推荐(0)
摘要:
open(path, ‘-模式-‘,encoding=’UTF-8’)即open(路径+文件名, 读写模式, 编码) 在python对文件进行读写操作的时候,常常涉及到“读写模式”,整理了一下常见的几种模式,如下: 读写模式:r :只读r+ : 读写w : 新建(会对原有文件进行覆盖)a : 追加b 阅读全文
posted @ 2020-03-17 15:13
哔仙女
阅读(705)
评论(0)
推荐(0)
摘要:
import os path1=os.path.abspath(__file__) print(path1)#当前文件的绝对路径 path2=os.path.dirname(os.path.abspath(__file__)) print(path2)#当前文件的上一层目录的绝对路径 path3=o 阅读全文
posted @ 2020-03-17 12:21
哔仙女
阅读(2010)
评论(0)
推荐(0)

浙公网安备 33010602011771号