NameError: global name '' is not defined

For the Python running console:
NameError: global name '' is not defined
How to solve it?
Insert picture description here

Insert picture description here

This operation error, the semantic meaning is: the global name is not defined

Insert picture description here

Insert picture description here

例如console台报错:
NameError: global name ‘time’ is not defined
NameError: global name ‘datetime’ is not defined

For such not defined nameerror, just import the package in the ''

import time
from datetime import datetime

This problem is solved
Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/JasonZ227/article/details/109740703
Recommended