User Tools

Site Tools


python

This is an old revision of the document!


Python

Important things to know in python:

How to read command line arguments

import sys
print sys.argv # this is an array containing all command line arguments inclusive the program name

How to make a python source code file executable

Code example:

#!/usr/bin/env python # this finds the default python executable defined by the current environment (PATH).
print "test"

In the console don't forget to give executable permissions:

chmod +x example.py
python.1343616390.txt.gz · Last modified: 2021/02/01 05:55 (external edit)