pip install yapf
$ PYTHONPATH=DIR python DIR/yapf [options] ...
usage: yapf [-h] [--style STYLE] [-d | -i] [-l START-END | -r] ...
Formatter for Python code.
positional arguments:
files
optional arguments:
-h, --help 显示帮助信息
--style STYLE 指定需要格式化的编程风格,如pep8或者google等
也可以是自定义的设置文件。默认是pep8
-d, --diff 比较格式化后的文件和原文件的区别
-i, --in-place 直接把格式化的文件更改在源文件上
-l START-END, --lines START-END
指定格式化的行的范围
-r, --recursive 在目录中递归运行
x = { 'a':37,'b':42,
'c':927}
y = 'hello ''world'
z = 'hello '+'world'
a = 'hello {}'.format('world')
class foo ( object ):
def f (self ):
return 37*-+2
def g(self, x,y=42):
return y
def f ( a ) :
return 37+-+a[42-x : y**3]
x = {'a': 37, 'b': 42, 'c': 927}
y = 'hello ' 'world'
z = 'hello ' + 'world'
a = 'hello {}'.format('world')
class foo(object):
def f(self):
return 37 * -+2
def g(self, x, y=42):
return y
def f(a):
return 37 + -+a[42 - x:y ** 3]
BAZ = {
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
}
BAZ = {[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]}
BAZ = {
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
} # yapf: disable
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有