Last active
August 29, 2015 14:06
-
-
Save paomian/89aa78d1192f4327270a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| queue = Queue | |
| class A(): | |
| def __init__(queue): #传入一个'queue'的字符串 | |
| exec('global %s' % queue) | |
| self.queue = queue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
你如果只是想要读写全局变量的话,可以用 globals() 这个 dict: