Python 为什么是';导入&x27;无效的语法?
我正在尝试导入一个包含问题的文件,还有什么我可以做的吗Python 为什么是';导入&x27;无效的语法?,python,syntax,Python,Syntax,我正在尝试导入一个包含问题的文件,还有什么我可以做的吗 #Main Menu print("Thank you for registering, Welcome to the main menu!") print("Please Choose a Subject") print("Geography - 1") print("News - 2") print("Tv/Movie - 3") Option1 = int(input("Please enter your selected numb
#Main Menu
print("Thank you for registering, Welcome to the main menu!")
print("Please Choose a Subject")
print("Geography - 1")
print("News - 2")
print("Tv/Movie - 3")
Option1 = int(input("Please enter your selected number:")
if Option1 == 1
import Option1
最后一次导入提供了无效语法您在输入结尾缺少一个右括号(
)
),在if
语句结尾缺少一个冒号(:
):
Option1 = int(input("Please enter your selected number:"))
# Was missing -------------------------------------------^
if Option1 == 1:
# Here ----^
import Option1
计算括号:
int(输入(“请输入您选择的数字”)
。计算冒号:如果选项1==1
欢迎使用堆栈溢出。请阅读,特别是如何创建堆栈溢出。