Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么是';导入&x27;无效的语法?_Python_Syntax - Fatal编程技术网

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
欢迎使用堆栈溢出。请阅读,特别是如何创建堆栈溢出。