如何在 python 中为对象构建一种新的语法



如何构建一种新的语法,当它被调用时,它会在os.system
中具有值

while True:
a=input('enter your direction: ')
if a!='':
!dir !+Shell(a)
else:
print('the dir can not be None')

根据您的澄清,也许这对您有用:

import subprocess
while True:
cmd = input("Enter a command: ")
if cmd != "":
cmd = cmd.split("!")[1]
subprocess.call(cmd, shell=True)
else:
print("Input cannot be None")

相关内容

最新更新