Skip to content Skip to sidebar Skip to footer

Global Variable Is Not Defined - Python

I have a problem with global variable. It returns error search = Search.Search(pattern,b) NameError: global name 'b' is not defined But I have already defined this global vari

Solution 1:

app = Flask(__name__)

global b

The global b statement here does not actually create a variable for you. You need to assign something to it yourself.

app = Flask(__name__)

b = None #or whatever you want the starting value to be

Post a Comment for "Global Variable Is Not Defined - Python"