Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.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,我的循环不起作用 Loop = True while loop: print ("hi") #should constanly print hi NameError:未定义名称“loop”问题在于,您将loop note大写字母L放入loop not大写字母L,然后将loop not大写字母L放入循环,这应该可以: 循环=真 while循环: 打印hi 您实际上不需要在这里声明变量 while True: print("hi") 循环与循环不同。大写L与小写L。这是不言自明

我的循环不起作用

Loop = True

while loop:
    print ("hi")
#should constanly print hi

NameError:未定义名称“loop”

问题在于,您将loop note大写字母L放入loop not大写字母L,然后将loop not大写字母L放入循环,这应该可以:

循环=真 while循环: 打印hi
您实际上不需要在这里声明变量

while True:
    print("hi")

循环与循环不同。大写L与小写L。这是不言自明的:NameError:未定义名称“loop”