给已有文件“实验中学学生花名册.txt”增加两名学生,而且不能覆盖原有的内容。 下面代码正确的是?( )
filename="实验中学学生花名册.txt" with open(filename,"w") as f: f.write("黎明\n") f.write("方芳\n")
filename="实验中学学生花名册.txt" with open(filename,"r") as f: f.write("黎明\n") f.write("方芳\n")
filename="实验中学学生花名册.txt" with open(filename,"r+") as f: f.write("黎明\n") f.write("方芳\n")
filename="实验中学学生花名册.txt" with open(filename,"a") as f: f.write("黎明\n") f.write("方芳\n")