[英]Pycharm is not reformatting code
我在python的每一行末尾都有分号和混合制表符和空格的缩进的传统代码。
PyCharm在代码检查时报告它,并建议重新格式化代码。 问题是,当我单击“重新格式化代码”(IDE建议)时,Pycharm不会执行任何操作-代码仍然包含分号和混合缩进。
为什么代码重新格式化不起作用?
样例代码:
for i in config.args.include:
if i.count(":") == 2:
path, output, prefix = i.split(":");
elif i.count(":") == 1:
path, prefix = i.split(":");
output = os.path.splitext(path)[0] + ".h";
else:
utils.fatal("Incorrect -a paramter tuple specification");
请给出代码示例。 ; 行尾不是python语法。 ; 在可行的代码中被忽略。 但是PyCharm无法解析例如:
print "fdfdf"; for x in [1, 2, 3]: print("dsds") print "d"
Ctrl + Alt + L:
print "fdfdf"; for x in [1, 2, 3]: print("dsds")
print "d"
但是可以解析:
print "fdfdf" for x in [1, 2, 3]: print("dsds") print "d"
至
print "fdfdf"
for x in [1, 2, 3]: print("dsds")
print "d"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.