在visual studio代码中注释python代码

时间:2016-09-30 21:59:51

标签: python visual-studio-code

我的visual studio代码使用'''注释python代码,而不是在尝试使用组合键#注释代码块时使用ctrl + shift + a。我有ubuntu 16.04

3 个答案:

答案 0 :(得分:3)

这与Visual Studio没有任何关系,但是python注释样式的结果。通常,单行注释使用井号(或哈希)符号:

# This is a comment

相比之下,可以使用三个引号(''或#34;"")来轻松生成多行注释。

'''
This is also a comment.
However, this comment crosses multiple lines
'''

"""
This is yet another multiline comment
For long comments the quotation marks are much easier than # comments.
"""

希望这有帮助。

答案 1 :(得分:2)

对于VS Code和Python,

  • 选择代码块

  • 要发表评论,请按CTRL + k + c

  • 要取消评论,请按CTRL + k + u

答案 2 :(得分:0)

在Windows环境下,这对我有用:

  • 选择块文本
  • CTRL + /
相关问题