工作在一个NFL CSV文件,可以帮助我自动评分的游戏。我现在只能把成绩上传到csv栏。在
这些都在A栏
示例: A
1 NYJ
2 27
3 PHI
4 20
5 BUF
6 13
7 DET
8 35
9 CIN
10 27
11 IND
12 10
13 MIA
14 24
15 NO
16 21
或者
^{pr2}$我想要的是:
A B C D
1 NYJ 27 PHI 20
2 BUF 13 DET 35
3 CIN 27 IND 10
4 MIA 24 NO 21
我已经阅读了以前关于这个的文章,但还没有让它发挥作用。有什么想法吗?在
当前脚本:
import nflgame
import csv
print "Purpose of this script is to get NFL Scores to help out with GUT"
pregames = nflgame.games(2013, week=[4], kind='PRE')
out = open("scores.csv", "wb")
output = csv.writer(out)
for score in pregames:
output.writerows([[score.home],[score.score_home],[score.away],[score.score_away]])
在不知道分数数据的情况下,尝试将writerows更改为writerow:
这将在一行中全部输出。在
您当前正在使用
.writerows()
写入4行,每行有一列。在相反,您需要:
写一行4列。在
相关问题 更多 >
编程相关推荐