python之函數用法globals()


# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#python之函數用法globals()


#globals()
#說明:在當前作用域下,查看全局變量
'''
globals(...)
    globals() -> dictionary
    
    Return the dictionary containing the current scope's global variables.
'''


#案例
b='xiaodeng'
print globals#<built-in function globals>
print globals()
'''
{
'b': 'xiaodeng',
'__builtins__': <module '__builtin__' (built-in)>,
'__file__': 'C:\\Users\\Administrator\\Desktop\\Test\\Test.py',
'__package__': None,
'__name__': '__main__',
'__doc__': "\nglobals(...)\n    globals() -> dictionary\n    \n    Return the dictionary containing the current scope's global variables.\n"
}
'''

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM