用 python 修改文件中指定的行数
#! /bin/pythonfilename='setup.ini'lines=[]with open(filename,'r') as f:lines=f.readlines()lines[1]='namespace = qmone-33c49600-4c22-486d-a397-e4f02bcdcf18' + '\n'lines[2]='interface = mon-...
·
#! /bin/python
filename='setup.ini'
lines=[]
with open(filename,'r') as f:
lines=f.readlines()
lines[1]='namespace = qmone-33c49600-4c22-486d-a397-e4f02bcdcf18' + '\n'
lines[2]='interface = mon-33c4960d-0c' + '\n'
with open(filename,'w') as f:
for data in lines:
f.write(data)
f.flush()
更多推荐
已为社区贡献4条内容
所有评论(0)