Creating variables from list and accessing globally
问题 I’m writing a program that pulls a list of departments from a database. I want to avoid hardcoding this since the list may change. I want to create a variable for each department to populate questions into a GUI. The problem I have is that I can create variables from the database list using the vars() function. I’m then storing the list of variable names so I can reference them elsewhere in my program. As long as I do everything in the same def, there is no problem. But I don’t know how to