Professional Documents
Culture Documents
Python Tutorial #1
Python Tutorial #1
.
Beginning Python
.
.. .
.
Netsoc
Stephen Shaw
2010
Schedule
This week - The basics
Week 2 - Modules, packages, the PYPI, Hacking up text with python -
screen scraping, regular expressions, unicode
Week 3 - Miscellaneous fun (maybe a bit of PyGame?)
Most likely in the Arts Building Mac labs next week - details later in the
week
These slides: http://www.netsoc.tcd.ie/~stesh/python/1.pdf
x, y = 4, 6
i f x != 5 and y < 100:
something ()
e l i f x % 2 == 0 or 0 < x < y < 34:
something_else ()
e l i f not ( True or False ) :
something_different () # Will never run
else :
stuff ()
ministers = [ ' Mary ' , ' Batt ' , ' Noel ' , ' Dermott ']
f o r minister i n ministers :
p r i n t ( minister + " has retired ! " )
f o r beatle i n { ' Ringo ' , ' George ' , ' Paul ' , ' John ' }:
p r i n t ( beatle )
council = {
' secretary ': ' br0kend '
' PRO ': ' lux ' ,
' treasurer ': ' dalamar ' ,
' amenities ': ' don ' ,
' auditor ': ' mk429 ' ,
' admin ': ' mu ' ,
' webmaster ': ' theorie '
}
council = {
' secretary ': ' br0kend '
' PRO ': ' lux ' ,
' treasurer ': ' dalamar ' ,
' amenities ': ' don ' ,
' auditor ': ' mk429 ' ,
' admin ': ' mu ' ,
' webmaster ': ' theorie '
}
Easy!
dosomething ()
try
raise
finally