这东西很简单啊…为啥每个都要写的那么长还定义什么num呢?
直接加一个:
next(f)
这就好了呀
附上读取某几列的txt代码
def ReadTxt(filename):
f = codecs.open(filename, mode='r', encoding='utf-8')
next(f) #这就跳过第一行了啊
line = f.readline()
list1 = []
while line:
a = line.split()
b = a[1:]
list1.append(b)
line = f.readline()
f.close()
return list1
如有失误请指出,谢谢
以上
更多推荐
#Python 读取txt时跳过第一行
发布评论