python 中读入文件跳过文件的前几行
001、
[root@PC1 test]# ls a.txt test.py [root@PC1 test]# cat a.txt ## 测试文件 1 abcd 2 abcd 3 abcd 4 abcd [root@PC1 test]# cat test.py ## 测试程序 in_file = open("a.txt", "r") in_file.next() ## 跳过一行 in_file.next() for i in in_file: i = i.strip() print(i) in_file.close() [root@PC1 test]# python test.py ## 执行结果 3 abcd 4 abcd


浙公网安备 33010602011771号