你是怎么读这个文件的,如果是x=f.readlines()直接del x[1] 就可以了如果是迭代器,当迭代到1(第2行)时跳过。
r=open("a.txt").readlines()del f[x]w=open("a.txt","w")w.write("".join(f))w.close()