具有指定整数值的变量向下移动到shell中的行

时间:2017-04-05 20:52:06

标签: python variables text printing

有人可以告诉我代码的哪一部分使得int变量向下移动而不被要求这样做。

    def option():
        file = open('firesideResults.txt')
        print ("\t\tPlayer Nickname\t\tMatches Palyed\t\tMatches Won\t\tMatches Lost\t\tPoints")
        for line in file:
                if line.split(',')[2] > "0":
                        player_name = line.split (',')[0]
                        matches_plyd = line.split (',')[1]
                        matches_won = line.split (',')[2]
                        matches_lost = line.split (',')[3]
                        points = int(matches_won)*3    
                        print("\n",player_name,"\t\t\t",matches_plyd,"\t\t\t",matches_won,"\t\t",matches_lost,"\t\t",points,)
                        continue
        file.close()

我希望结果以

格式排列
  Roy     17    10    7    30

然而输出是:

  Roy    17    10    7
      30

我想知道如何制作'积分'变量旁边的行中的其他变量。谢谢。

0 个答案:

没有答案