现在有一串文本:
c 5579 7560 c 570 5892
c 1671 3227 c 570 5892
c 10470 12031 c 5894 16023
c 12336 14316 c 5894 16023
想要变成这样
c 5579 5892
c 1671 3227
c 10470 12031
c 12336 14316
count = len(open('test.txt','r').readlines())
with open('test.txt','r')as fin:
i = 0
while i < 0:
lines = fin.readline()
line = lines.split()
if lines.startswith('c'):
if int(line[1]) < int(line[4]):
if int(line[2]) < int(line[5]):
print(line[0] , line[4] , line[2])
elif int(line[2]) > int(line[5]):
print(line[0],line[4],line[5])
elif int (line[1]) > int(line[4]):
if int(line[2]) < int(line[5]):
print(line[0], line[1], line[2])
elif int(line[2]) > int(line[5]):
print(line[0], line[1], line[5])
else:
continue
i +=1
运行结果
Process finished with exit code 0
结果没有出现错误,但是没有print出任何结果
请问有朋友在知道原因吗?或者应该怎么修改么?