为什么'import'语法无效?

时间:2018-03-23 21:30:04

标签: 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 number:")

if Option1 == 1
              import Option1

最后一次导入会产生无效的语法

1 个答案:

答案 0 :(得分:1)

您在输入结尾处缺少右括号(')),并在:语句末尾缺少冒号(if):

Option1 = int(input("Please enter your selected number:"))
# Was missing -------------------------------------------^

if Option1 == 1:
    # Here ----^
    import Option1