A quick way to comment/uncomment lines in
Put your cursor on the first # character, press
For commenting a block of text is almost the same:
- First, go to the first line you want to comment, press
- Then using the arrow key and select until the last line.
- Now press
- Then press
#vim #comment #comment_out #visual_block
vim:Put your cursor on the first # character, press
Ctrl+V, and go down until the last commented line and press x, that will delete all the # characters vertically.For commenting a block of text is almost the same:
- First, go to the first line you want to comment, press
Ctrl+V. This will put the editor in the VISUAL BLOCK mode.- Then using the arrow key and select until the last line.
- Now press
Shift+I, which will put the editor in INSERT mode and then press #. This will add a hash to the first line.- Then press
Esc (give it a second), and it will insert a # character on all other selected lines.#vim #comment #comment_out #visual_block
If you want to comment a block of code out in
#python #jinja2 #comment #comment_out
Jinja2 template, use {# ... #}. It can also span into multiple lines:{#
<tr class="">
<td colspan="2" style="font-family:Ubuntu,Helvetica,Arial,sans-serif; padding: 0px 0px 0px 20px;" class="">
Regards,
</td>
</tr>
<tr class="">
<td colspan="2" style="font-family:Ubuntu,Helvetica,Arial,sans-serif; padding: 0px 0px 30px 20px;" class="">
SYSTEM INFO
</td>
</tr>
#}#python #jinja2 #comment #comment_out
urlparse library is used in python in order to well, parse a URL.Consider the example below:
from urlparse import urlparse
google_url = urlparse('https://www.google.com/profile?active=true#comment')
google_url is now of type ParseResult class, which includes all data we need:The protocol used in URL is achievable by:
print url.scheme
'https'
Absolute url of the google url is retrieved by
netloc:print url.netloc
'www.google.com'
The path section of the URL which is after the domain section is:
print url.path
'/profile'
Query section of the URL:
print url.query
'active=true'
The
fragment part of url is stored in fragment attribute:print url.fragment
'comment'
#python #urlparse #url