欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

python常用操作

程序员文章站 2022-05-29 17:02:30
...

清空列表:

list[:] = []

替换行首行尾的\n

str = str.strip("\n")

 文件追加模式写:

with open(file, 'a+') as f: