前言:Python-cheatsheet是一份超全的Python速查表,最大的特点就是你无需安装和配置,在线就能使用,内容十分全面
7921 Star!Python学习的必备法宝,随查随用,太方便了吧
大多数的cheatsheet都是简单的语法规则列表,如果你手头有一份cheatsheet会让你的工作效率大大提升。
近日,有一叫Python-cheatsheet项目在Hacker News、Reddit、Github等网站上成功引起了广大程序员的注意。
Python-cheatsheet是一份超全的Python速查表,最大的特点就是你无需安装和配置,在线就能使用,内容十分全面

目前,python-cheatsheet已经过在Github上获得 7885 个Star,1572 个Fork(Github地址:https://github.com/gto76/python-cheatsheet)

清单的开头就对这份内容进行一个梳理,可以看出内容涵盖:容器、类型、语法、系统、数据、库,以及Advanced Python等。你只要点击相关知识点,就会跳转到相关的详情页,下面以Main和List为例
关注起航学习网(http://www.epx365.cn)
if __name__ == '__main__': # Runs main() if file wasn't imported.
main()
List
<list> = <list>[from_inclusive : to_exclusive : ±step_size]
<list>.append(<el>) # Or: <list> += [<el>]
<list>.extend(<collection>) # Or: <list> += <collection>
<list>.sort()
<list>.reverse()
<list> = sorted(<collection>)
<iter> = reversed(<list>)
sum_of_elements = sum(<collection>)
elementwise_sum = [sum(pair) for pair in zip(list_a, list_b)]
sorted_by_second = sorted(<collection>, key=lambda el: el[1])
sorted_by_both = sorted(<collection>, key=lambda el: (el[1], el[0]))
flatter_list = list(itertools.chain.from_iterable(<list>))
product_of_elems = functools.reduce(lambda out, x: out * x, <collection>)
list_of_chars = list(<str>)
index = <list>.index(<el>) # Returns index of first occurrence or raises ValueError.
<list>.insert(index, <el>) # Inserts item at index and moves the rest to the right.
<el> = <list>.pop([index]) # Removes and returns item at index or from the end.
<list>.remove(<el>) # Removes first occurrence of item or raises ValueError.
<list>.clear() # Removes all items. Also works on dict and set.
整份文档基本都是代码,只有个别内容会添加一些简短的文字说明,对于用法创建者为了减少使用者的负担,只给了最常见的用法,用最简洁的方式给你最需要的用法
文章出自:http://qh.itpxw.cn/peixun/software/201949258.html
文章标题:零基础学python技术 你要掌握这些python学习的必备法宝
免责声明:本站文章均由入驻起航学习网的会员所发或者网络转载,所述观点仅代表作者本人,不代表起航学习网立场。如有侵权或者其他问题,请联系举报,必删。侵权投诉
(责任编辑:IT培训网)
IT培训网 访问该机构站点 报名留言 加为好友 用户等级:注册会员
用户级别:10
机构名称:IT培训网
联 系 人:罗老师
联系电话:13783581536
联系手机:13783581536
在线客服:
在 线 QQ:
电子邮件:
网站域名:http://www.itpxw.cn
注册时间:2016-07-18 11:07
最后登录:2024-02-20 13:02
Java定义方法的格式是什么?IT培训网小编来告诉大家。所谓方法...
大家在Java教程中会学到关于Java消息推送的知识,那么,Java消息...
常用的Java日期格式转换有哪些?IT培训网小编来告诉大家。 1...
Java创建对象数组的方法是什么?IT培训网小编来告诉大家。Ja...