Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/321.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.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空闲语法有问题无效_Python - Fatal编程技术网

python空闲语法有问题无效

python空闲语法有问题无效,python,Python,错误:- def main(): # Input place = input("Will we go to north carolina?") if (place == "Yes"): print ("The drive will take all most a full day.") else: print ("I do not know how lo

错误:-

def main():
    
    # Input
    place = input("Will we go to north carolina?")
    if (place == "Yes"):
        print ("The drive will take all most a full day.")
    else:
        print ("I do not know how long the drive wil last.")
   
main()

代码:-

def main():
    
    # Input
    place = input("Will we go to north carolina?")
    if (place == "Yes"):
        print ("The drive will take all most a full day.")
    else:
        print ("I do not know how long the drive wil last.")
   
main()

它表示语法无效,并以红色突出显示main

您应该在脚本模式下运行此多行代码,方法是转到New->File


如果只想使用此功能,请在函数后单击两次enter键以返回提示

您可以先尝试输入函数,然后按两次enter键,以便再次在屏幕上看到“>>>”,然后调用主函数。