我试图使import
成为可选的模块,但我无法以更简单的方式重写代码(其工作原理如下):
import sys
sys.path.append('\python_work\chemistry\import')
prompt = "Would you like to check if calculus worked as it should? (yes/no) "
if prompt == 'yes':
import normal_termination
elif prompt == 'no':
# pale_green + end are from a colouring module
print(pale_green + "Skipping to the next step" + end)
else:
active = True
while active:
message = input(prompt)
if message == 'yes':
active = False
import normal_termination
elif message == 'no':
active == False
print(pale_green + "Skipping to the next step" + end)
break
我尝试了很多不同的方法,但都不管用。
我想让它做的是:问一个简单的问题。如果回答=是->import
;如果答案=否->print(message)
;如果回答!=是的,回答!=否,重复用户输入
也许是这样的:
相关问题 更多 >
编程相关推荐