Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >专栏 >python里使用vars()返回当前局部作用域的所有成员函数和成员变量

python里使用vars()返回当前局部作用域的所有成员函数和成员变量

作者头像
用户7886150
修改于 2021-01-25 02:28:45
修改于 2021-01-25 02:28:45
1.2K0
举报
文章被收录于专栏:bit哲学院bit哲学院

参考链接: Python vars()

vars()函数是返回给出参数所有成员,以字典的方式返回。例子如下:

# File: builtin-vars-example-1.py

book = "library2"

pages = 250

scripts = 350

print("the %(book)s book contains more than %(scripts)s scripts" % vars())

结果输出如下:

the library2 book contains more than 350 scripts>>>

在这里可以看到%(book)是从vars()返回的字典里获取参数,后面的%(scripts)同理。

Python游戏开发入门

 http://edu.csdn.net/course/detail/5690

你也能动手修改C编译器

 http://edu.csdn.net/course/detail/5582

纸牌游戏开发

http://edu.csdn.net/course/detail/5538 

五子棋游戏开发

http://edu.csdn.net/course/detail/5487RPG游戏从入门到精通http://edu.csdn.net/course/detail/5246WiX安装工具的使用http://edu.csdn.net/course/detail/5207俄罗斯方块游戏开发http://edu.csdn.net/course/detail/5110boost库入门基础http://edu.csdn.net/course/detail/5029Arduino入门基础http://edu.csdn.net/course/detail/4931Unity5.x游戏基础入门http://edu.csdn.net/course/detail/4810TensorFlow API攻略http://edu.csdn.net/course/detail/4495TensorFlow入门基本教程http://edu.csdn.net/course/detail/4369C++标准模板库从入门到精通 http://edu.csdn.net/course/detail/3324跟老菜鸟学C++http://edu.csdn.net/course/detail/2901跟老菜鸟学pythonhttp://edu.csdn.net/course/detail/2592在VC2015里学会使用tinyxml库http://edu.csdn.net/course/detail/2590在WindowsSVN的版本管理与实战 http://edu.csdn.net/course/detail/2579Visual Studio 2015开发C++程序的基本使用 http://edu.csdn.net/course/detail/2570在VC2015里使用protobuf协议http://edu.csdn.net/course/detail/2582在VC2015里学会使用MySQL数据库http://edu.csdn.net/course/detail/2672

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
社区富文本编辑器全新改版!诚邀体验~
全新交互,全新视觉,新增快捷键、悬浮工具栏、高亮块等功能并同时优化现有功能,全面提升创作效率和体验
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文