大多数备忘单都是简单的语法规则列表。近日,一个名为Python-cheatsheet的项目在HackerNews、Reddit、Github等网站上成功吸引了程序员的关注。Python-cheatsheet是一个超级全面的Python备忘单。最大的特点是无需安装和配置即可在线使用。内容非常全面。目前python-cheatsheet在Github上获得了7885个Stars和1572个Fork(Github地址:https://github.com/gto76/python-cheatsheet)榜首,整理了这部分内容。可以看到内容涵盖了:容器、类型、语法、系统、数据、库和高级Python等。只要点击相关知识点,就会跳转至相关详情页面。以Main和List为例Mainif__name__=='__main__':#Runsmain()iffilewasn'timported.main()List=
[from_inclusive:to_exclusive:±step_size]
.append(
+=[
.extend(
+=
.sort()
.reverse()
=sorted(
)sum_of_elements=sum(
))product_of_elems=functools.reduce(lambdaout,x:out*x,
.index(
.insert(index,
.pop([index])#Removesandreturnssitematindexorfromtheend.
.remove(
.clear()#Removesallitems.Alsoworksondictandset.整个文档基本上都是代码,只是个别内容会加上一些简短的文字说明。为了减轻用户的负担,用法创建者只给出最常用的用法,用最简洁的方式给你最需要的用法。如果不想在线使用本文档,也可以下载正文,下载地址:https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md项目地址:https://github.com/gto76/python-备忘单
