python基础autopep8__python代码规范
关于PEP 8
PEP 8,Style Guide for Python Code,是Python官方推出编码约定,主要是为了保证 Python 编码的风格一致,提高代码的可读性。
官网地址:https://www.python.org/dev/peps/pep-0008/
关于Autopep8
Autopep8是自动将Python代码格式化为符合PEP 8风格的工具。它使用pycodestyle工具来确定代码的哪些部分需要被格式化。Autopep8能够修复大部分pycodestyle检测的格式问题。
github地址:https://github.com/hhatto/autopep8
安装:
pip install autopep8
使用命令:
autopep8 --in-place --aggressive --aggressive <filename>
参数说明:
>usage: autopep8 [-h] [--version] [-v] [-d] [-i] [--global-config filename] > [--ignore-local-config] [-r] [-j n] [-p n] [-a] > [--experimental] [--exclude globs] [--list-fixes] > [--ignore errors] [--select errors] [--max-line-length n] > [--line-range line line] > [files [files ...]] > > Automatically formats Python code to conform to the PEP 8 style guide. > > positional arguments: > files files to format or '-' for standard in > > optional arguments: > -h, --help show this help message and exit > --version show program's version number and exit > -v, --verbose print verbose messages; multiple -v result in more > verbose messages > -d, --diff print the diff for the fixed source > -i, --in-place make changes to files in place > --global-config filename > path to a global pep8 config file; if this file does > not exist then this is ignored (default: > ~/.config/pep8) > --ignore-local-config > don't look for and apply local config files; if not > passed, defaults are updated with any config files in > the project's root directory > -r, --recursive run recursively over directories; must be used with > --in-place or --diff > -j n, --jobs n number of parallel jobs; match CPU count if value is > less than 1 > -p n, --pep8-passes n > maximum number of additional pep8 passes (default: > infinite) > -a, --aggressive enable non-whitespace changes; multiple -a result in > more aggressive changes > --experimental enable experimental fixes > --exclude globs exclude file/directory names that match these comma- > separated globs > --list-fixes list codes for fixes; used by --ignore and --select > --ignore errors do not fix these errors/warnings (default: E24) > --select errors fix only these errors/warnings (e.g. E4,W) > --max-line-length n set maximum allowed line length (default: 79) > --line-range line line, --range line line > only fix errors found within this inclusive range of > line numbers (e.g. 1 99); line numbers are indexed at
python基础autopep8__python代码规范的更多相关文章
- python基础===autopep8__python代码规范
关于PEP 8 PEP 8,Style Guide for Python Code,是Python官方推出编码约定,主要是为了保证 Python 编码的风格一致,提高代码的可读性. 官网地址:http ...
- python基础(代码规范、命名规范、代码缩进、注释)
代码规范 PEP8(python增强建议书第8版) 每个import语句只导入一个模块 不要在行尾添加分号";" 建议每行不超过80个字符 超出部分可以用()来进行换行例如: ...
- Python基础:编码规范(4)
1.命名规范 Python中不同代码元素采用不同命名方式: ◊ 包名:全部小写字母,中间可以由点分隔开.作为命名空间,包名需具有唯一性. ◊ 模块名:全部小写字母,如果是多个单词构成,使用下划线分隔. ...
- 1.4 Python基础知识 - 代码书写格式及条件判断"if ... else ..."
一.代码的书写规则 在所有的开发语言中,代码之间都是有关联的关系,有的是包含关系,有的是上下级关系,有的是代表语句的结束.在python中也是有相应的规则的: 1.在没有上下级关系的代码中,代码要顶行 ...
- 【Python】python基础_代码编写注意事项
1. 说明使用的编译方式 1 #!/usr/bin/python 2. 说明字符编码方式 1 #coding=utf-8 3. print 默认输出是换行的,如果要实现不换行需要在变量末尾加上逗号 # ...
- python的PEP8代码规范
一.缩进:每级缩进用4个空格.如果缩进不正确或缩进格式不统一,一般错误信息会明确告诉你,但有时也会出现invalid syntax报错.所谓缩进不正确,python的缩进是四个空格或一个TAB,如果缩 ...
- javascript基础 之 代码规范
1,变量名 1,变量名推荐使用小驼峰写法:类似于:firstName 2,全局变量和常量建议用大写:PI 3,支持下划线 2,缩进 1,一般使用4个空格当作缩进,tab建议少用 2,运算符左右和左花括 ...
- python的PEP8 代码风格指南
PEP8 代码风格指南 这篇文章原文实际上来自于这里:https://www.python.org/dev/peps/pep-0008/ 知识点 代码排版 字符串引号 表达式和语句中的空格 注释 版本 ...
- python基础1 - 多文件项目和代码规范
1. 多文件项目演练 开发 项目 就是开发一个 专门解决一个复杂业务功能的软件 通常每 一个项目 就具有一个 独立专属的目录,用于保存 所有和项目相关的文件 – 一个项目通常会包含 很多源文件 在 ...
随机推荐
- android离线缓存技术
离线缓存是指在有网络的状态下将从服务器获取的网络数据,如Json 数据缓存到本地,在断网的状态下启动APP时读取本地缓存数据显示在界面上,常用的APP(网易新闻.知乎等等)都是支持离线缓存的,这样带来 ...
- Mac OS 终端常用命令基础
基础概念 OS X 采用的Unix文件系统,所有文件都挂在跟目录" /" 下面,所以不在要有Windows 下的盘符概念.比如什么"C:"你在桌面上看到的硬盘都 ...
- "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no freetype in java.library.path
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no freetype in java ...
- WebService学习--(四)调用第三方提供的webService服务
互联网上面有很多的免费webService服务,我们可以调用这些免费的WebService服务,将一些其他网站的内容信息集成到我们的Web应用中显示,下面就以获取天气预报数据和查询国内手机号码归属地为 ...
- JMM
1.JMM简介 i.内存模型概述 Java平台自动集成了线程以及多处理器技术,这种集成程度比Java以前诞生的计算机语言要厉害很多,该语言针对多种异构平台的平台独立性而使用的多线程技术支持也是具有开拓 ...
- Oracle12c中性能优化&功能增强新特性之临时undo
临时表最有意思的特点之一是undo段也存储在常规undo表空间中,而它们的undo反过来被redo保护,这会导致一些问题. 1) 写undo表空间需要数据库以读写模式打开,因此,只读数据库和物理备库 ...
- 实现CString的Format功能,支持跨平台
#include <string>#include <stdio.h> #include <stdarg.h> std::string& std_strin ...
- Web运营手记
1.图片是给活人用户看的,相对来讲,文字是给搜索引擎看的.精华内容争取要在网站或者频道主页里面让人看到. 2.搜索引擎喜欢看的几种文字:页面标题.关键词元信息(只有Bing管点用).描述(descri ...
- Nginx 怎么给一台服务器,配置两个域名?详细的解说+截图教程
一. 环境.条件准备 一台云服务器(我的是腾讯的centos7) 至少两个域名.(我的是simuhunluo.xyz和simuhunluo.top.这两个域名之间没有任何关系,我是在阿里 ...
- Android开发之adb无法连接
2017/11/14 21:20 Unable to run 'adb': null 21:20 'E:\AndroidSDK\platform-tools\adb.exe start-server' ...