# 限制行数
file = open("in.json", "r", encoding='utf-8')
out_file = open("out.json", "w")
lines = file.readlines()
n = 0
for i in lines:
if n < 758: # 删除换行符的最后一行行数
i = i[:-1]
out_file.write(i)
n += 1
file.close()
out_file.close()
# 不限制行数
file = open("in.txt", "r", encoding='utf-8')
out_file = open("out.txt", "w")
lines = file.readlines()
n = 0
for i in lines:
i = i[:-1]
out_file.write(i)
file.close()
out_file.close()