Python语法的“一五一十”

mac2026-01-27  4

文章目录

前言 1条绝对规范——缩进 2个顶级定义——函数(def)和类(class) 3种语句结构——顺序、分支和循环 4种数据类型——整型、浮点型、布尔型、字符串 5大内置类——列表、字典、元组、集合、字符串 10组最常用的内置函数 后记

前言

三十年前(1989年),龟叔(Guido van Rossum)开立山门之时,在 this 模块中暗藏了一首禅意十足的诗歌——Python 之禅,表明了他的、且已体现在 Python 中的编程理念。

>>> import this The Zen of Python, by Tim Peters - Python之禅 by Tim Peters Beautiful is better than ugly. - 优美胜于丑陋 Explicit is better than implicit. - 明了胜于晦涩 Simple is better than complex. - 简洁胜于复杂 Complex is better than complicated. - 复杂胜于凌乱 Flat is better than nested. - 扁平胜于嵌套 Sparse is better than dense. - 间隔胜于紧凑 Readability counts.
最新回复(0)