Global variable and python flask
问题 What i want to do is just display the firstevent from one API. The variable is called “firstevent” and the value should display on the webpage. But firstevent is inside a def, so i change it into a global variable and hope it can be used across different functions. But it shows “NameError: global name 'firstevent' is not defined”. This is what I am doing: define a global variable global firstevent send this variable a random value, it supposed to be events['items'][1]['end'] firstevent = 1