用于字符串自动格式化的PyCharm代码样式

时间:2017-03-20 21:48:08

标签: python pycharm

我无法在PyCharm中创建有用/干净的代码样式,在我执行代码自动格式化时不会破坏我的代码。

一般来说,我希望我的字符串看起来像这样:

message = ("There are " + str(avd_instances) + " AVD instances about to be created according to set, "
           "but there were only " + str(requested_ports_to_use_num) + " ports ")

或者那样:

raise MyException(
    TAG,
    "There are " + str(avd_instances) + " AVD instances about to be created according to set, "
    "but there were only " + str(requested_ports_to_use_num) + " ports "
)

但我得到的是这样的:

enter image description here

或类似的东西:

enter image description here

这简直太丑了,而且有一种混乱。还有更糟糕的情况。

目前我的代码样式如下所示: enter image description here

如果您有其他建议,我如何格式化我的代码以使其与PyCharm"兼容?我会很高兴听到。

0 个答案:

没有答案