# -*- 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'}

 

相关文章:

  • 2021-06-11
  • 2021-09-05
  • 2021-12-07
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-02
  • 2021-11-17
  • 2021-10-01
  • 2022-12-23
相关资源
相似解决方案