Python 在输入提示中使用字符串格式?

Python 在输入提示中使用字符串格式?,python,string,Python,String,我相信很容易看出我在这里想做什么。我是完全错了还是犯了一个简单的错误?我想说: “PlayerA的名字”,请选择 您的替换需要完全在括号内完成: raw_input("%s, Please choose; Rock (R), Paper (P), or Scissors (S): " % (playerA)) 否则,将根据调用结果执行此操作 此外,您似乎没有理由有时使用原始输入,有时使用输入。如果您使用的是Python 2,请始终使用原始输入。问题在于您的偏执。试着这样做: playerA =

我相信很容易看出我在这里想做什么。我是完全错了还是犯了一个简单的错误?我想说:

“PlayerA的名字”,请选择


您的替换需要完全在括号内完成:

raw_input("%s, Please choose; Rock (R), Paper (P), or Scissors (S): " % (playerA))
否则,将根据调用结果执行此操作


此外,您似乎没有理由有时使用原始输入,有时使用输入。如果您使用的是Python 2,请始终使用原始输入。

问题在于您的偏执。试着这样做:

playerA = raw_input("Please enter your name: ")
playerB = raw_input("Please enter your name: ")
choiceA = input("%s, Please choose; Rock (R), Paper (P), or Scissors (S): " % (playerA))
choiceB = input("%s, Please choose; Rock, Paper, or Scissors: " % (playerB))

谢谢你。这样做作为大学作业的一部分,讲师会特别使用输入进行选择。谢谢,我现在就换。
playerA = raw_input("Please enter your name: ")
playerB = raw_input("Please enter your name: ")
choiceA = input("%s, Please choose; Rock (R), Paper (P), or Scissors (S): " % (playerA))
choiceB = input("%s, Please choose; Rock, Paper, or Scissors: " % (playerB))