简体   繁体   English

Python3我的代码不想再次输入

[英]Python3 My Code Doesn't want input again

asd = 1
limit = "+-*/1234567890 "

while asd:
    data = input("YOUR PROCESS? ")
    for i in data:

        if i not in limit:
            print("?? ERROR ?? ")
            quit()

        else:
            print(eval(data))

            again = input("AGAIN? (E/H)")

            if again == "E":
                pass

            else:
                 print("GOOD BYE... \n")
                 asd = 0

When I execute this code after one process, it doesn't want new value for "data". 当我在一个过程之后执行此代码时,它不需要“ data”的新值。 Running with first data value. 以第一个数据值运行。 How can i solve this? 我该如何解决?

it is running this for each character in the input: 它为输入中的每个字符运行此命令:

        print(eval(data))

        again = input("AGAIN? (E/H)")

        if again == "E":
            pass

        else:
             print("GOOD BYE... \n")
             asd = 0

try getting rid of the else that it is in, and putting the above block right in the while loop (after the for loop not in it) 尝试摆脱它所在的else,并将上面的块放到while循环中(在for循环之后不在其中)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我能否以某种方式合并这些类,这样我就不必一次又一次地编写它,并且我的 python 代码不会变得多余 - Can I somehow merge these classes such that I don't have to write this again and again and my python code doesn't get redundant 我希望我的 python 代码在用户请求或输入无效后重新开始 - I want my python code to start over again after the user has requested so or has given invalid input 如何编辑我的 VS Code 环境,以便我可以为我的 Python 代码预设输入数据,这样我就不必一次又一次地输入数据 - How do I edit my VS Code environment so that I can preset Input data for my Python Code so that I don't have to input data again and again 虽然循环不会把我的变量 python3 加起来 - While loop doesn't add up my variable python3 我试图从输入中打印每个verible 的数量,但是我的代码并没有写出我想要的东西,尽管它看起来是正确的。 python - Im trying to print the amount of every verible from input, but my code doesn't write what I want it though it seems right. python 我的python代码运行了几次,但是一旦我关闭计算机或执行其他操作,它就不会再次运行 - My python code runs a few times but as soon as I close my computer or do something else, it doesn't run again 我的代码在函数python3 / tkinter中不起作用 - My code doen't work inside a function, python3/tkinter 如何指定升华文本是我想使用python2.7还是python3运行python代码 - How to specify to sublime text whether I want to run my python code with python2.7 or python3 Python代码无法与[input]一起运行 - Python code doesn't run with [input] 如果用户没有在 python3 中提供语音输入,如何手动接受用户输入 - How to manually take user input if user doesn't give voice input in python3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM