w3cschool 编程狮,随时随地学编程
下载APP
|
登录
个人中心
首页
入门教程
编程课程
特色实战
畅学全站
首页
/
Python 风格指南
/
Python 尾逗号规范 | Google 官方序列格式
Python 尾逗号规范 | Google 官方序列格式
序列的尾部要添加逗号吗?
Tip
仅当
]
,
)
,
}
和最后一个元素不在同一行时,推荐在序列尾部添加逗号。我们的 Python 自动格式化工具会把尾部的逗号视为一种格式提示。
Python 缩进规范 4 空格 | Google 官方对齐方式
Python Shebang 写法 | Google 官方入口文件规范
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录
Google Python 风格指南背景 | 官方规范由来
Python 语言规范
pylint 用法大全 | Google Python 代码检查规范
Python 导入规范 | Google 官方 import 规则详解
Python 包导入规范 | Google 官方最佳实践
Python 异常处理规范 | Google 官方最佳实践
Python 全局变量规范 | Google 官方避坑指南
Python 嵌套函数与内部类规范 | Google 官方指南
Python 推导式与生成式规范 | Google 官方写法
Python默认迭代器规范 | Google官方写法
Python 生成器规范 | Google 官方 yield 最佳实践
Python Lambda 函数规范 | Google 官方单行写法
Python 条件表达式规范 | Google 官方三目写法
Python 默认参数值规范 | Google 官方避坑指南
Python 特性 (property) 规范 | Google 官方用法
Python True/False 求值规范 | Google 官方写法
Python 词法作用域规范 | Google 官方闭包写法
Python 装饰器使用规范 | Google 官方指南
Python 线程安全规范 | Google 官方并发指南
Python 禁用的黑魔法 | Google 官方避坑指南
Python future 导入规范 | Google 官方现代语法指南
Python 类型注释规范 | Google 官方 PEP-484 实践
Python 风格规范
Python 分号使用规范 | Google 官方代码风格
Python 行宽规范 80 字符 | Google 官方换行指南
Python 括号使用规范 | Google 官方风格指南
Python 缩进规范 4 空格 | Google 官方对齐方式
Python 尾逗号规范 | Google 官方序列格式
Python Shebang 写法 | Google 官方入口文件规范
Python 文档字符串规范 | Google 官方 PEP-257 实战
Python 注释写作规范 | Google 官方标点语法指南
Python 字符串规范 | Google 官方 f-string 最佳实践
Python 资源管理规范 | Google 官方 with 语句指南
Python TODO 注释规范 | Google 官方待办写法
Python import 语句格式规范 | Google 官方分组排序法
Python 语句规范 | Google 官方单行写法
访问器 (getter) 和设置器 (setter)
Python 命名规范大全 | Google 官方 PEP-8 速查表
Python 主程序入口规范 | Google 官方 main() 写法
Python 函数长度规范 | Google 官方 40 行准则
Python 类型注解规范 | Google 官方 PEP-484/585 速查
临别赠言
关闭
MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }