简体   繁体   English

使Visual Studio代码检测python兼容性错误

[英]Make visual studio code detect python compatibility errors

Is there anything that allows visual studio code to tell you if you are writing python code that is not compatible with both python 2 and 3 versions? 是否有任何东西可以让Visual Studio代码告诉您您是否在编写与python 2和3版本都不兼容的python代码? I know that PyCharm has this feature but I'd prefer not to switch between IDEs depending on the language I'm coding in. 我知道PyCharm具有此功能,但是我不希望根据我所使用的语言在IDE之间切换。

For example, print "Hello world!" 例如, print "Hello world!" should give me an error because its not compatible with python 3. assert 3 / 2 == 1.5 should give me an error because it's not compatible with python 2. 应该给我一个错误,因为它与python 3不兼容。assert assert 3 / 2 == 1.5应该给我一个错误,因为它与python 2不兼容。

如果您在Python扩展中设置了--py3k ,然后将--py3k设置为在--py3k处于打开状态下运行,则您将收到有关Python 2/3兼容性的警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM