简体   繁体   中英

comment python code in visual studio code

My visual studio code comment python code with ''' instead of using # when try to comment a block of code with the key combination ctrl + shift + a . I have ubuntu 16.04

For VS Code and Python ,

  • Select the block of code

  • For Commenting press CTRL + k + c

  • For Un comment press CTRL + k + u

This has nothing specifically to to with Visual Studio, but a result of the python commenting styles. Generally, single line comments are done with the pound (or hash) symbol:

# This is a comment

In contrast, three quotation marks (either ''' or """) can be used to easily produce multi-line comments.

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

or

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

Hope this helps.

Under Windows environment this work for me :

  • select block text
  • press CTRL + /

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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