python - 从第 2 行读取文件或跳过标题行

如何跳过标题行并从第 2 行开始读取文件?

最佳答案

with open(fname) as f:
    next(f)
    for line in f:
        #do something

https://stackoverflow.com/questions/4796764/

相关文章:

linux - chmod 777 到一个文件夹和所有内容

python - 在 Python 中以 YYYY-MM-DD 获取今天的日期?

python - Python 和 IPython 有什么区别?

linux - 递归查找具有特定扩展名的文件

linux - 在 Linux 系统上快速创建大文件

python - 如何获取方法参数名称?

linux - 如何从 shell 将一个文件 append 到 Linux 中的另一个文件?

python - 我应该在 Python 中使用 "camel case"还是下划线?

linux - 如果任何命令返回非零值,则中止 shell 脚本

python - Python进程使用的总内存?