小编pha*_*1no的帖子

蟒蛇尾巴.最佳性能实施

我是编程和Python的新手.
我编写了一个实现unix尾部的函数:

def tail(file):
    strin = open(file, 'r')
    lis = strin.readlines()
    lastline = lis[-1]
    return lastline
    strin.close()
Run Code Online (Sandbox Code Playgroud)

但我认为它在性能上并不是最佳的.
我该如何改进?

python performance deque

1
推荐指数
1
解决办法
5546
查看次数

标签 统计

deque ×1

performance ×1

python ×1