Back to Python

Reviewing Python studies after a break on doing other things such as moves, work projects and life.  Here’s some of my notes from the past reviews and notebooks.

Data Objects

object.attribute
function(argument)
object.method(argument)
list = ['a', 'b', 'c']
dictionary = {'key':'value','key':'value'}
tuple = ('bob',40)
for target in object:
    statement
else:
    statement

Files

f = open ('foo.txt', 'rU')
for line in f:
    print(line),
f.close()

Classes

def myclass(mylocallist):
   print(mylocallist)

myclass(mylist)

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: