【发布时间】:2014-04-18 17:01:04
【问题描述】:
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 和其他百分比在这段代码中做了什么。我了解有关代码的所有其他内容,它的作用等,但我不太了解百分比的作用。我知道它通常用作模数,并会告诉您两个数字之间的余数被除。对此进行澄清将不胜感激。
【问题讨论】:
标签: python