Open the git bash and type where python
Copy the output line and paste it at the top of your script (very first line) preceeded by a hash (#)
For example:
#!c:/Users/barraud/AppData/Local/Programs/Python/Python35/python.exe
Open the git bash at the py location
To compile the py, enter
chmod +x <name>.py
To run the script, enter
./<name>.py
- The #! statement must be at the very first line
- import statement There must be a blank line between the first line and the
- def statement There must be at least two blank lines before a def statement
- There must be no space between a function call and the opening bracket:
print('something') - Function call: There must be a single space after a comma:
print('something, 'something else') - Function names: use underscore instead of camel case for variable/function names:
add_numinstead ofaddNumor evenaddnum - Semi colon for flow statements: There must be no space before the semi colon in flow statments:
if condition:instead ofif condition : - The last line of a file must be a blank line. But only one blank line
See also: Intermezzo: Coding Style