Perl中有个很好用的工具叫PerlTidy可以实现如下功能
$a=1;
$b = "hello";
$foo = "bar";
$helloworld = "abc";
变为
$a = 1;
$b = "hello";
$foo = "bar";
$helloworld = "abc";
请问Python有可以实现类似排版的tidy工具么?
Perl中有个很好用的工具叫PerlTidy可以实现如下功能
$a=1;
$b = "hello";
$foo = "bar";
$helloworld = "abc";
变为
$a = 1;
$b = "hello";
$foo = "bar";
$helloworld = "abc";
请问Python有可以实现类似排版的tidy工具么?
2 回答5.1k 阅读✓ 已解决
2 回答1.1k 阅读✓ 已解决
4 回答966 阅读✓ 已解决
3 回答1.1k 阅读✓ 已解决
3 回答1.2k 阅读✓ 已解决
1 回答1.7k 阅读✓ 已解决
1 回答1.2k 阅读✓ 已解决
众所周知,Perl和Python的文化在很多方面是不同的。PEP20中提到了其中一点,There should be one-- and preferably only one --obvious way to do it.
你提到的这种对齐方式与PEP8的要求不符,所以不太可能被主流的工具支持。当然,你要是打算自己写个Python Tidy,也没人拦着你。