with open('opcn3.txt','rt') as input_data: if line.strip() == ',': break count = 0 for line in input_data: count+=1 if count == 168: break print(line) data_file.close()數(shù)據(jù):我想跳過值直到 40,然后從第一個(gè) 0 開始讀取或打印27/12/2018-14:36:40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,78,12,114,1,72,97,93,128,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,6,0,74,100
2 回答

侃侃爾雅
TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超16個(gè)贊
我認(rèn)為這可能是一個(gè)解決方案:
with open('opcn3.txt', 'r') as fx:
for line in fx:
counter = True
line = line.split(',')
for thing in line:
if counter:
counter = False
else:
print(thing)
添加回答
舉報(bào)
0/150
提交
取消