When creating python code and keeping to the PEP8 style guide, one can have trouble to limit the line length to 79 characters when quoting a long URL in a comment:
def foo():
# see http://stackoverflow.com/questions/13062540/replacing-text-using-regular-expression-in-python-with-named-parameters
do_something()
In the actual code this looks ugly, when the URL comment overlaps with the otherwise empty indentation area on the left of the code. Is there some way to handle this in a better way, while I am still able to easily copy-and-paste the URL to put it into a web-browser?
The most straight-forward way to comment out a block of code in Python is to use the # character. Any Python statement that begins with a hashtag will be treated as a comment by the compiler. There's no end to how many block comments you can have, in a row or otherwise.
hover on the link & get a pop-up with a link to press. press 'option'+'click' on the URL at the comment itself.
So, here are the steps to insert a hyperlink into a comment on your LinkedIn post: Copy your web link. Create a comment below your post. Paste the link to the site.
Basic Links You can also select text and press CTRL + L to make it a link, or press CTRL + L with no text selected to insert a link at the current position.
Of the many possible way, use a \ at the end of line after closing the quotes
url = "http://stackoverflow" \
".com"
response = urllib2.urlopen(url)
print response.read()
In case you have a field such as url split on multiple lines and want easier way to copy it back, use multi line string i.e. surround your whole url with 3 double quotes on both start and end. Then they can span any number of lines.
Edit: I wrote multiline comments which was suggested in comments and has been fixed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With