如果不作为模块使用,百分比符号在python中做什么
所以我的问题是%12.12和其他百分比在这段代码中做了什么。我了解代码的其他一切,它在做什么,等等,但我不太了解百分比的作用。我知道它通常是一个模,它会告诉你两个数被除后的余数。对此进行澄清将不胜感激。它不支持字符串的格式化 更多信息:如果不作为模块使用,百分比符号在python中做什么,python,Python,所以我的问题是%12.12和其他百分比在这段代码中做了什么。我了解代码的其他一切,它在做什么,等等,但我不太了解百分比的作用。我知道它通常是一个模,它会告诉你两个数被除后的余数。对此进行澄清将不胜感激。它不支持字符串的格式化 更多信息: def getresults(candidates, parties, votes, percentageofvote): results = "/=\/=\=/=\=/=\=/=\=/=\Election Results/=\=/=\=/=\=/=\
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)