玩蛇网提供最新Python编程技术信息以及Python资源下载!

超多量python数据怎么排版格式能更好看

诸如下面这种的,数据一长格式排版就不好看了,不知道如何排版是好?

result = Animal.filter(name='dog', sex='female', age='2', color='yellow').limit(100).order(born)

测试勋章

result = Animal.filter(
        name='dog',
        sex='female',
        age='2',
        color='yellow'
    ).limit(100).order(born)

可参考PEP8中对缩进的建议。

Yes:

# Aligned with opening delimiter
foo = long_function_name(var_one, var_two,
                         var_three, var_four)

# More indentation included to distinguish this from the rest.
def long_function_name(
        var_one, var_two, var_three,
        var_four):
    print(var_one)

No:

# Arguments on first line forbidden when not using vertical alignment
foo = long_function_name(var_one, var_two,
    var_three, var_four)

# Further indentation required as indentation is not distinguishable
def long_function_name(
    var_one, var_two, var_three,
    var_four):
    print(var_one)

Optional:

# Extra indentation is not necessary.
foo = long_function_name(
  var_one, var_two,
  var_three, var_four)

玩蛇网文章,转载请注明出处和文章网址:https://www.iplaypy.com/wenda/wd20363.html

相关文章 Recommend

玩蛇网Python互助QQ群,欢迎加入-->: 106381465 玩蛇网Python新手群
修订日期:2017年05月24日 - 18时41分50秒 发布自玩蛇网

您现在的位置: 玩蛇网首页 > Python问题解答 > 正文内容
我要分享到:

必知PYTHON教程 Must Know PYTHON Tutorials

必知PYTHON模块 Must Know PYTHON Modules