为什么要“用块评论进行评论”在 PyCharm 1.5.4 中始终被禁用?
我发现菜单代码| “使用块评论进行评论”始终处于禁用状态。
如何修复它?
I have found that the menu Code | "Comment with Block comment" is always disabled.
How to fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
因为在Python中,没有块注释这样的东西。
这里的
""" 内容 """
用于文档。Because in Python, there is no such thing as a block comment.
The
""" stuff here """
is for documentation.Ctrl+/(取消)注释所有选定的行。同意它不直观,但有效
Ctrl+/ (un)comments all selected lines. Agree it is not intuitive, but works
虽然 Python 确实没有块注释,但我最近从 Aptana Studio 切换过来,它有一个很好的块注释格式,可以保留空格/标识,允许您按块取消注释并支持换行,这很整洁。
我想你不可能拥有一切!
While it's true that Python doesn't have block comments, I've recently switched from Aptana Studio and that had a nice block comment format which preserved spaces/idents, allowed you to uncomment by block and supported wrapping which was neat.
I guess you can't have everything!
守则 |如果 pycharm 不知道为特定文件类型添加注释的语法,“使用块注释进行注释”将保持灰色。您可以在文件 | 中进行配置。设置,然后选择编辑器/文件类型。选择要为其配置注释的可识别文件类型,如果不存在则添加它。
The Code | "Comment with Block Comment" stays grayed out if pycharm does not know the syntax for adding comments for the particular file type. You can configure this in File | Settings, then select Editor/File Type. Select the Recognized File type that you want to configure comments for, or add it if it does not exist.
一般来说,在PyCharm中注释代码,我们使用哈希符号
#
,快捷键是:对于单行注释我们使用Ctrl + / ,要取消注释,请重做一次。
对于多行注释,我们选择这些行,然后使用 Ctrl + / ,要取消注释,请在保持选定这些行的同时再次执行此操作。
Generally, In PyCharm for commenting out the code, we use Hash symbol
#
, shortcut keys are:For a single line comment we use Ctrl + / , for uncomment do it again.
For multiline comments we select those lines and then use Ctrl + / , for uncommenting do it again while keeping those lines selected.
某些 IDE(Wingware、PyCharm)允许您选择一系列行,然后键入
#
字符 (Wingware),选择 Ctrl + / (PyCharm),或其他方法。通过在每行中的第一个非白色字符之前放置#
来注释掉每一行。Some IDEs (Wingware, PyCharm) allow you to select a range of lines and then type the
#
character (Wingware), select Ctrl + / (PyCharm), or other method. This comments out each line by placing#
just before the first none-white character in each line.