0


python基础知识思维导图总结

今天给同学用思维导图整理了python基础知识,供大家复习参考学习,希望每天都有进步。

最后增加了列表推导式的案例和使用,学会了一定很香!

鸡汤几点:

没有目标永远不知道方向在哪?

不去尝试永远不知道答案和结果?

打破习惯、冲击惯性思维、不断学习,才能使你越来越有价值。

行动永远比坐以待毙更幸运。

主要内容:

一、Python简介

二、输入输出

三、变量、数据基本类型与操作

四、条件判断

五、常用数据类型--列表

六、常用数据类型--元组tuple、字典dict(全称dictionary)

七、常用数据类型--布尔值(True or False)

八、循环语句

九、函数

十、类与对象

十一、编码与文件读写

十二、模块与库

**十三、总结思维过程

最后补充:常见的错误类型**

新增列表推导式应用案例

一、Python简介:

二、输入和输出:

三、变量、数据基本类型与操作:

四、条件判断:

五、常用数据类型-列表

六、常用数据类型- 元组、字典

七、常用数据类型- 布尔值

八、循环语句

九、函数

十、类与对象

十一、编码与文件读写

十二、模块与库

十三、总结思维过程

总结思维过程:解决问题、实现目标。基本思路:

1、明确目标,定位问题

2、分析过程,拆解问题;如果没有更好的办法可以先以实现为主

3、逐步执行、各个击破

4、参考官方文档、博客找答案

5、根据以往经验编写出逻辑函数

补充:常见的错误类型

列表推导式案例1:有如下接口返回结果,需要取出data列表的指定参数(比如取出appNames为auto_zabbix的id)?

{"result":"success","message":null,"data":[{"id":"035548f3-d48d-45ba-8d37-da00ab757134","description":"auto_1649842493455","owner":"246283097","createTime":1649842494625,"updateTime":1649842494625,"deleted":0,"status":"ACTIVE","priority":6341,"reporter":"yangkai","assignor":"","project":"DEMO","triggerPriority":"2","issueTypeId":"10004","triggers":[{"id":"728c329c-5932-494c-bb31-4d938e721685","triggerId":"035548f3-d48d-45ba-8d37-da00ab757134","app":"62d520d39bcb41c78643b77fe87a9682","createTime":1649842494625,"updateTime":1649842494625,"deleted":0,"priority":6341,"exps":[],"apps":["62d520d39bcb41c78643b77fe87a9682"],"appNames":["auto_prometheus"]}]},{"id":"427ec5d6-f3c0-49b1-ba6f-f4c22b96e00c","description":"auto_1649842491891","owner":"246283097","createTime":1649842494276,"updateTime":1649842494276,"deleted":0,"status":"ACTIVE","priority":7413,"reporter":"yangkai","assignor":"","project":"DEMO","triggerPriority":"2","issueTypeId":"10004","triggers":[{"id":"416d462f-c9d3-40bf-a912-48cb599ed1d0","triggerId":"427ec5d6-f3c0-49b1-ba6f-f4c22b96e00c","app":"8db5c50e1d8f4dfe96d537439bbc9cec","createTime":1649842494276,"updateTime":1649842494276,"deleted":0,"priority":7413,"exps":[],"apps":["8db5c50e1d8f4dfe96d537439bbc9cec"],"appNames":["auto_zabbix"]}]},{"id":"e4ac27bc-296e-4360-b191-3d171359ec8c","description":"auto_jira","owner":"246283097","createTime":1649661923493,"updateTime":1649842165186,"deleted":0,"status":"ACTIVE","priority":12,"reporter":"yangkai","assignor":"","project":"DEMO","triggerPriority":"2","issueTypeId":"10004","triggers":[{"id":"76084cb6-04a2-46b3-b0a6-d2ae8ad8176e","triggerId":"e4ac27bc-296e-4360-b191-3d171359ec8c","app":"76e554415c024713a50f199fa6d9ef7e","createTime":1649661923493,"updateTime":1649661923493,"deleted":0,"priority":12,"exps":[],"apps":["76e554415c024713a50f199fa6d9ef7e"],"appNames":["auto_dynatrace"]}]}],"totalCount":0,"code":200}

这种结果使用列表推导式就很香了,返回结果肯定是列表了:

**zabbix_id**= [rule_json['data'][x]['id'] for x in range(len(rule_json['data'])) if
             rule_json['data'][x]['triggers'][0]['appNames'][0] == 'auto_zabbix']

以上内容就是这些,一定对同学有所帮助!

以上总结的思维导图知识点,百度网盘下载路径(永久有效):

链接:https://pan.baidu.com/s/1sn6e2dmhwR1Rq_vOLfhf4w?pwd=27wf
提取码:27wf

标签: python

本文转载自: https://blog.csdn.net/wangjianhuahua/article/details/118460942
版权归原作者 fighterme 所有, 如有侵权,请联系我们删除。

“python基础知识思维导图总结”的评论:

还没有评论