If you assign a value to g_times_map outside the function, then you do not need a global statement inside the function, and you can still reference the value of g_times_map outside the function. Although I don't know what you want to do, but depending on whether you are using global g_times_map in two functions, you may also be using it in multiple functions, which is easy to make mistakes. If you just want these functions to reference the value of g_times_map outside the function, there is no need to use the global statement.
http://stackoverflow.com/ques...
This link has a solution, use the database to save data locally
global variables should be defined outside the function.
If you assign a value to g_times_map outside the function, then you do not need a global statement inside the function, and you can still reference the value of g_times_map outside the function. Although I don't know what you want to do, but depending on whether you are using global g_times_map in two functions, you may also be using it in multiple functions, which is easy to make mistakes. If you just want these functions to reference the value of g_times_map outside the function, there is no need to use the global statement.