📅  最后修改于: 2022-03-11 14:45:10.667000             🧑  作者: Mango
f = open("path_to_file", "r")
contents = f.readlines()
f.close()
contents.insert(index, value)
f = open("path_to_file", "w")
contents = "".join(contents)
f.write(contents)
f.close()