Python-原始输入不工作

Python-原始输入不工作,python,defined,Python,Defined,好的,我把它改成: if input('a'): print ("You: Gimme a gun!") if input('b'): print ("You: Fine") 但是现在我没有选择,它迫使我选择a,然后它迫使我选择b,一旦我越过这个障碍,我就有了剩下的比赛,但我真的需要帮助来解决这个问题 顺便说一句,我不是巨蟒 import time Gimme=True Fine=True print ("James: Ah, it looks like s

好的,我把它改成:

if input('a'):
      print ("You: Gimme a gun!")

if input('b'):
       print ("You: Fine")
但是现在我没有选择,它迫使我选择a,然后它迫使我选择b,一旦我越过这个障碍,我就有了剩下的比赛,但我真的需要帮助来解决这个问题 顺便说一句,我不是巨蟒

import time
Gimme=True
Fine=True




print ("James: Ah, it looks like subject 091-266 is awake")
time.sleep(4)
print ("Scarlet: Hello, do you remember anything? The crash or anything?")
time.sleep(4)
print ("You: What.... Where am I?")
time.sleep(3)
print ("Scarlet: Oh, where are my manners, this is the head quarters of the XionRepublic, Xion")                        
time.sleep(5)
print ("James: You were involved in Z-9102, code named Attack-Z")
time.sleep(4)
print ("Scarlet: We were able to pull you and three others out before we  were forced to...")                                             
print ("James: Exterminate Alpha Base 12.")
time.sleep(6)
print ("You: Exterminate?! Couldn't you just quarantine it?")
time.sleep(4)
print ("Scarlet: No, Alpha Base 12 had over 3,000 people in it, it was to risky to quarantine")      
time.sleep(5)
print ("James: Do you recognize these names, Noah, Alex or Robert?")
time.sleep(4)
print ("You: Yes Alex!? Why? Is he ok?!")
time.sleep(3)
print ("James: Yes, Yes he was one of the three.")
time.sleep(4)
print ("*ALARM! SECURITY BREACHED, SECURITY BREACHED*")
time.sleep(4)
print ("James: Scarlet lock the door!")
time.sleep(3)
print ("You: Whats going on?!")
time.sleep(3)
print ("James: Z's there here.")
time.sleep(3)
print ("*Screaming*")
time.sleep(2)
print ("You: I can fight!")
time.sleep(3)
print ("Scarlet: Trust me you are not in any condition to fight due to some of the drugs in you")   
print ("CHOICE")
print ("A.Gimme the gun!")
print ("B.Fine")

if raw_input() == Gimme:
    print ("You: Gimme a gun!")
if raw_input() == Fine:
    print ("You: Fine")

您似乎正在使用Python 3。在Python3中,.

您似乎正在使用Python3。在Python3中,.

如果您使用的是新版本的Python——3.x.x——那么原始输入就不再存在。改为使用输入(提示)。它的工作原理基本相同。基本语法:

foo = input("some prompt"). 

输入的作用是从标准输入文件或
中读取一行。它在
()
中打印提示,然后等待用户输入。示例:(
>
是命令行提示符,
如果您使用的是新版本的python--3.x.x--则原始输入不再存在。请改用输入(提示符)。其工作原理基本相同。基本语法:

foo = input("some prompt"). 
输入的作用是从标准输入文件或
中读取一行。它在
()
中打印提示,然后等待用户输入。例如:(
>
是命令行提示,
是您的新问题:

但现在我没有选择,它迫使我选择a,然后在那之后,它迫使我选择b

这是因为您调用了两次
input()
,每次调用时,都会提示您键入一些内容。您想调用一次,将得到的值存储在变量中,并将该变量与可能的选项进行比较。

这是您的新问题:

但现在我没有选择,它迫使我选择a,然后在那之后,它迫使我选择b


这是因为您调用了两次
input()
,每次调用它时,系统都会提示您键入一些内容。您希望调用一次,将得到的值存储在变量中,并将该变量与可能的选项进行比较。

如果您的python版本为3.x,则使用
input()
。其可能的重复项不是重复项,它甚至不会出现在相关…@user2278741:您阅读了链接的问题吗?它准确地解释了问题所在,并给出了与回答您原始问题的人相同的答案。如果您的python版本是3.x,则使用
input()
。它的可能重复项不是重复项,它甚至没有出现在相关项下…@user2278741:您阅读了链接问题吗?它准确地解释了问题所在,并给出了与回答您原始问题的人相同的答案。您阅读什么来学习Python?希望它已经解释了variables现在…当您调用
input
函数时,您告诉python您希望用户进行输入。如果您调用
input
两次,python会认为您需要两个输入。您阅读了什么来学习python?希望它现在已经解释了变量…当您调用
input
函数时,您告诉pyt如果您调用
input
两次,python会认为您需要两个输入。
print ("CHOICE")
print ("A.Gimme the gun!")
print ("B.Fine")
choice = input("What do you choose?")
if choice == 'A' or choice == 'a':
    #Some Action 
if choice == 'B' or choice == 'b': 
    #Some Other Action