[英]python formatter (autopep8, paste format) (VSCode)
I'd like to copy and paste some code but which code's format so dirty.我想复制和粘贴一些代码,但是哪个代码的格式太脏了。
eg例如
n = input()
while True:
try:
if (int(n) < 10):
pass
else:
pass
except:
break
after paste粘贴后
n = input()
while True:
try:
if (int(n) < 10):
output = str(n) * 2
else:
pass
if (int(n) < 10):
pass
else:
pass
except:
break
I want我想
n = input()
while True:
try:
if (int(n) < 10):
pass
else:
pass
if (int(n) < 10):
pass
else:
pass
except:
break
Also second one doesn't work formatter like autopep8.第二个也不能像 autopep8 那样使用格式化程序。 I mean autopep8 can change second one to third one.我的意思是 autopep8 可以将第二个更改为第三个。
Is it normal?正常吗? Even option's are "editor.formatOnSave": true, "editor.formatOnPaste": true甚至选项是"editor.formatOnSave": true, "editor.formatOnPaste": true
Please help me.请帮我。 Thank you.谢谢你。 Have a nice day:)祝你今天过得愉快:)
I fell in love with https://pypi.org/project/black/ , which is automatically formatting your code in your editor right before saving it.我爱上了https://pypi.org/project/black/ ,它会在保存之前自动在编辑器中格式化您的代码。 Simple to install, no maintenance.安装简单,无需维护。 Just look up how to install it to your editor.只需查看如何将其安装到您的编辑器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.