python实现文件倒数N行读取

python并无直接提供读取文件倒数N行的方法,本身写了一个简易tail。 性能测试: 返回字符串: 100000行:0.219849s 10000行:0.024092s 1000行:0.004009s python def tail(file, taillines=500, return_str=True, avg_line_length=None): """avg_line_lengt
相关文章
相关标签/搜索