我正在尝试根据我们在某个范围中的最后一项时间进行条件处理,例如:
for i in range(intNumberOfPlayers):
#If we are on the last item in the range, do this...
答案 0 :(得分:1)
for i in range(intNumberOfPlayers):
if i == intNumberOfPlayers - 1:
print(i) #print last item
范围不包括在内,因此最后一项是intNumberOfPlayers - 1