<分区>
我想用python创建一个程序,当程序运行时,它会显示自己的命令行界面。用户可以在界面中输入命令,程序将处理该命令。有什么办法可以在Windows 和Linux 环境中做到这一点吗?
<分区>
我想用python创建一个程序,当程序运行时,它会显示自己的命令行界面。用户可以在界面中输入命令,程序将处理该命令。有什么办法可以在Windows 和Linux 环境中做到这一点吗?
最佳答案
这应该适用于 linux 和 windows:
from subprocess import call
while True:
print call(raw_input("command: "), shell = True)
关于python - python的命令行界面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37158933/