Python 从指定行读取文件

from itertools import islice

with open('xxx', 'r') as f:
    for line in islice(f.readlines(), 1, None):
        print(line)

上述代码可以实现从第二行(下标为1)打印数据

猜你喜欢

转载自www.cnblogs.com/wangmantou/p/9066114.html
今日推荐