简体   繁体   English

如何在python3中保持程序打开

[英]How do I keep program open in python3

I'm almost new to python and I'm making a kind of command line.我几乎是 python 的新手,我正在制作一种命令行。 I want to make it keep open after pressing enter.我想让它在按下回车后保持打开状态。 In C#, I used goto for example:在 C# 中,我使用goto例如:

start:
a = Console.ReadLine("Enter Command:");
goto start;

But now, I don't know how to do that in python.但是现在,我不知道如何在 python 中做到这一点。

There is no goto in Python. Python 中没有goto However you can create an infinite loop.但是,您可以创建一个无限循环。

while True:
   input()

An example:一个例子:

while True == True:
    dum = raw_input("Enter Command:")

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

相关问题 python程序终止后,如何保持控制台窗口打开以查看产生的任何错误? - How do I keep a console window open after my python program terminates to see any errors produced? 关闭脚本后如何保持启动的程序打开 - how do i keep a started program open after closing the script 如何在 python 程序中跟踪时间? - How do I keep track of time in a python program? 如何跟踪实例属性的值如何在多个方法中更改? Python3 - How do I keep track of how an instance attribute's value is changed across multiple methods? Python3 如何将 Python 程序转换为 CLI 而无需键入 python3 来执行? - How do I turn a Python program into a CLI without having to type python3 to execute? 在调用函数时如何防止GUI冻结? (PyQT4,Python3) - How do I keep GUI from freezing, while calling a function? (PyQT4, Python3) 如何在python中确定外部程序是否打开? - How do I determine in python if an external program is open? 如何从普通的python程序打开pypy进程? - How do I open a pypy process from an ordinary python program? 如何为 python3 安装 netfilterqueue? - How do I install netfilterqueue for python3? 从python3脚本中,如何将字符串传递到bash程序中? - From a python3 script, how to I pipe a string into a bash program?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM