How to comment out a block of code in Python [duplicate]

Python does not have such a mechanism. Prepend a # to each line to block comment. For more information see PEP 8. Most Python IDEs support a mechanism to do the block-commenting-with-pound-signs automatically for you. For example, in IDLE on my machine, it’s Alt+3 and Alt+4. Don’t use triple-quotes; as you discovered, this is for documentation strings not block comments, although it … Read more

OR condition in Regex

Try or add a positive lookahead if you don’t want to include the trailing space in the match When you have two alternatives where one is an extension of the other, put the longer one first, otherwise it will have no opportunity to be matched.

How to open a file using the open with statement

Python allows putting multiple open() statements in a single with. You comma-separate them. Your code would then be: And no, you don’t gain anything by putting an explicit return at the end of your function. You can use return to exit early, but you had it at the end, and the function will exit without it. (Of course with functions that return … Read more

How to use execvp()

The first argument is the file you wish to execute, and the second argument is an array of null-terminated strings that represent the appropriate arguments to the file as specified in the man page. For example:

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)