我对此代码的目标是,当您输入一定数量时,您将根据键入的内容打印数字和其他输出.出于某种原因,我在这里给出了错误"ValueError:incomplete format".它与%有关.错误意味着什么,我该如何解决?谢谢!
variable = "Blah"
variable2 = "Blahblah"
text = raw_input("Type some stuff: ")
if "1" in text:
print ("One %" % variable)
elif "2" in text:
print ("Two %" % variable2)
Run Code Online (Sandbox Code Playgroud) 我正在努力做一个审查员.而不是做
if curseword in typed or curseword2 in typed or curseword3 typed:
print "No cursing! It's not nice!"
Run Code Online (Sandbox Code Playgroud)
我想这样做,以便我可以有一个包含所有单词的列表,并且可以检查这些单词是否在列表中.注意:如果你使用"if any ..."代码,使用while循环,它有太多的输出要处理.