player_A score Player_A player_B score_Player B
MP22 3 MP02 2
MP30 1 MP22 3
MP02 3 MP20 2
MP22 3 MP01 2
MP30 3 MP18 0
MP02 3 MP03 2
MP12 1 MP20 3
MP01 3 MP14 0
MP22 3 MP07 1
MP23 2 MP18 3
MP26 0 MP30 3
MP02 3 MP28 2
MP03 3 MP13 2
MP16 1 MP12 3
MP15 1 MP20 3
大家好,上面是我的csv文件,我试图循环第1列和第3行。它是关于网球游戏。谁有3个结果我想能够排名他们;谁以降序赢得了大多数比赛。感谢您的帮助。下面的代码不会执行任务。
fp = open("DADSA COURSEWORK A TAC1 ROUND ONE men.csv")
#
fp.readline()
#for the final position.
s = fp.readline().rstrip().split()
if int(s[1]) > int(s[3]):
listofranking.append(s[0])
listofranking.append(s[2])
else:
listofranking.append(s[2])
listofranking.append(s[0])
#positioning for the semi.
for i in range(2):
s = fp.readline().rstrip().split()
if int(s[1]) > int(s[3]):
listofranking.append(s[0])
else:
listofranking.append(s[2])
#positioning for the quater round.
for i in range(4):
s = fp.readline().rstrip().split()
if int(s[1]) > int(s[3]):
listofranking.append(s[0])
else:
listofranking.append(s[2])
#positioning for the last 16
for i in range(8):
s = fp.readline().rstrip().split()
if int(s[1]) > int(s[3]):
listofranking.append(s[0])
else:
listofranking.append(s[2])
print(i)
print(s)