【发布时间】:2017-03-16 14:02:29
【问题描述】:
我必须读取文件的最后 4 行。
我尝试了以下方法:
top_tb_comp_file = open('../../ver/sim/top_tb_compile.tcl', 'r+')
top_tb_comp_end = top_tb_comp_file.readlines()[:-4]
top_tb_comp_file.close()
没有用(我在top_tb_comp_end 中得到文件的第一行)。
【问题讨论】:
标签: python python-3.x file