对于一个项目,我需要一个程序询问竞赛名称,在另一个问题中使用该名称。
下面的代码有效。
主要问题是我需要将时间作为值输入并保存,以便以后可以计算它,但是在显示 time = """""
的行中打印,不起作用。< br/>
关于如何解决这个问题有什么建议吗?
def main():
print "~*~*~*~*~*~ Timbuktu Archery Contest ~*~*~*~*~*~"
archerList = [] #list
name = raw_input ("Enter contestants first name: ")
s = str(name)
archerList.append(name)
print "Enter time (in milliseconds) for " + s , raw_input (": ")
main()
最佳答案
我认为你需要这样做
t = raw_input ("Enter time (in milliseconds) for %s :" % s)
关于python - 变量中有原始输入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14889813/