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


#locals()
#说明:查找局部变量,返回一个名字/值对的字典对象。只具备查找权限
'''
locals(...)
    locals() -> dictionary
    
    Update and return a dictionary containing the current scope's local variables.
'''



#案例
def test():
    name='xiaodeng'
    version=2.7
    time='2015.11.07'
    print locals()

    
print test()#{'version': 2.7, 'name': 'xiaodeng', 'time': '2015.11.07'}

 

无语言基础,自学python所做的各种笔记,欢迎大牛指点.