def getresults(candidates, parties, votes, percentageofvote):
results = "/=\/=\=/=\=/=\=/=\=/=\Election Results/=\=/=\=/=\=/=\=/=\=/=\=/=\/\n\n Candidate Party Votes Percent\n\n\n"
for x in range(len(candidates)):
results = results + "%12.12s"%candidates[x] + "\t%3.3s"%parties[x] + "\t%3.3s"% votes[x] + "\t" + str(percentageofvote[x]) + "\n"
return(results)
所以我的问题是%12.12以及其他百分比在此代码中的作用。我理解代码的所有其他内容,它的功能等,但我不太清楚百分比的作用。我知道通常它作为一个模数工作,并会告诉你两个数字之间的剩余部分。对此的澄清将非常感激。