美文网首页
python: globals() v.s. locals()

python: globals() v.s. locals()

作者: 庞贝船长 | 来源:发表于2017-12-06 15:49 被阅读0次

globals() v.s. locals() v.s. vars()

  • globals()
    always returns the dictionary of the module namespace
  • locals()
    always returns a dictionary of the current namespace
  • vars()
    returns either a dictionary of the current namespace (if called with no argument) or the dictionary of the argument.

相关栗子阅读: python globals

参考

相关文章

网友评论

      本文标题:python: globals() v.s. locals()

      本文链接:https://www.haomeiwen.com/subject/daqlixtx.html