用 python 修改文件中指定的行数

 #! /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()
上一篇:C++关于Union使用的部分总结


下一篇:Latch2:Latch和性能