コード例 #1
0
def writePlayerStats():
	out = open(playerstatspath,'a')
	tags = 'Name,Season,Age,Tm,Lg,Pos,G,GS,MP,FG,FGA,FG%,3P,3PA,3P%,2P,2PA,2P%,eFG%,FT,FTA,FT%,ORB,DRB,TRB,AST,STL,BLK,TOV,PF,PTS\n';
	out.write(tags)
	out.close()
	print("starting to get all players stats...")
	infile=csv.reader(open(playerurlspath,'rb'), delimiter=',')
	urls = []
	if infile:
	   infile.next()
	   for row in infile:
		urls.extend(row)
	   for url in urls:
   		href = mainurl + url
		PlayerStats.getPlayerStats(href, playerstatspath)
	else:
	   urls = CompareMethods.getPlayerUrls(True)
	   for url in urls:
   		href = mainurl + url
		PlayerStats.getPlayerStats(href, playerstatspath)
	print ('Stats All Done!')
	return;
コード例 #2
0
def writePlayerSalary():
	salaryout = open(playersalarypath,'a')
	salarytags = 'Name,Season,Team,Lg,Salary\n';
	salaryout.write(salarytags)
	salaryout.close()
	print("starting to get all players salary...")
	infile=csv.reader(open(playerurlspath,'rb'), delimiter=',')
	urls = []
	if infile:
	   infile.next()
	   for row in infile:
		urls.extend(row)
	   for url in urls:
   		href = mainurl + url
		PlayerSalary.getPlayerSalary(href, playersalarypath)
	else:
	   urls = CompareMethods.getPlayerUrls(True)
	   for url in urls:
   		href = mainurl + url
		PlayerSalary.getPlayerSalary(href, playersalarypath)
	print ('Salary All Done!')
	return;