Python fundamentals

Array/list

my_list = [1,"string",3,4,5]
for item in my_list:
    print item

# Append/push to list
my_list.append("addMe")

Modules

Always good to modular your code.

module1.py

def addNumbers(numberOne, numberTwo):
    return numberOne + numberTwo

script.py

import module1

total = module1.addNumbers(1,2)
print total

Pip - package management

Pip is the python package manager. It ca be used to download other modules.

Install pip

sudo apt-get install python-pip

To install package

pip install package

Simple prints to command line

python -c 'print "A"*4'

results matching ""

    No results matching ""