I try to use a parameter of another function. I prefer to not use global variable. I try the following one, but I have an error. I search in google and here but I haven't found something to help me
class MainHandler(BaseHandler):
def get(self):
******
all_list = *a list*
******
def post(self):
for i in self.all_list:
if i[0] == something:
****
And I have this error: AttributeError: 'MainHandler' object has no attribute 'all_list'
You need to set
self.all_list = *a list*
self
is the instance that gets passed to the function, what you are doing at the moment is just setting a local variable to the function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.