Benutzer:Andreas Plank/Python

Aus Offene Naturführer BiolFlor
Wechseln zu: Navigation, Suche

Dictionaries

mydict = {'one': 0, 'two': 23}
for k, v in mydict.iteritems():
    # also mydict.iterkeys() mydict.itervalues()
    print "key: %5s; value: %5s" % (k, v)

mydict.keys()
# ['two', 'one']
mydict.values()
# [23, 0]

Install/Setup

# install of a package manually downloaded
sudo python setup.py install --record files_installed.txt
# unistall files (only manually)
sudo rm $(cat files_installed.txt)
# make sure the package directory is removed as well, e.g. /usr/local/lib/python2.6/site-packages/xlrd/


sudo easy_install --record files_installed.txt xlrd