加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 移动互联 > 正文

7921 Star!Python进修的必备瑰宝,随查随用,太利便了吧

发布时间:2019-07-27 14:52:40 所属栏目:移动互联 来源:佚名
导读:大大都的cheatsheet都是简朴的语礼貌则列表,假如你手头有一份cheatsheet会让你的事变服从大大晋升。 克日,有一叫Python-cheatsheet项目在Hacker News、Reddit、Github等网站上乐成引起了宽大措施员的留意。 Python-cheatsheet是一份超全的Python速查表,
副问题[/!--empirenews.page--]

 7921 Star!Python进修的必备瑰宝,随查随用,太利便了吧

大大都的cheatsheet都是简朴的语礼貌则列表,假如你手头有一份cheatsheet会让你的事变服从大大晋升。

克日,有一叫Python-cheatsheet项目在Hacker News、Reddit、Github等网站上乐成引起了宽大措施员的留意。

Python-cheatsheet是一份超全的Python速查表,最大的特点就是你无需安装和设置,在线就能行使,内容异常全面

7921 Star!Python进修的必备瑰宝,随查随用,太利便了吧

今朝,python-cheatsheet已颠末在Github上得到 7885 个Star,1572 个Fork(Github地点:https://github.com/gto76/python-cheatsheet)

7921 Star!Python进修的必备瑰宝,随查随用,太利便了吧

清单的开头就对这份内容举办一个梳理,可以看出内容涵盖:容器、范例、语法、体系、数据、库,以及Advanced Python等。你只要点击相干常识点,就会跳转到相干的详情页,下面以Main和List为例

Main
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.

整份文档根基都是代码,只有个体内容会添加一些简短的笔墨声名,对付用法建设者为了镌汰行使者的承担,只给了最常见的用法,用最简捷的方法给你最必要的用法

假如你不想在线行使该文档,你也可以下载文本,下载地点:https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md

项目地点:https://github.com/gto76/python-cheatsheet

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读