Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 2 ** 200
1606938044258990275541962092341162602522202993782792835301376L
>>> 
>>> 'spam' + '!!!'
'spam!!!'
>>> 
>>> import sys
>>> sys.platform
'win32'
>>> ================================ RESTART ================================
>>> 
1267650600228229401496703205376
['C:\\pyclass', 'C:\\Python27\\Lib\\idlelib', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']
spamNI
>>> ================================ RESTART ================================
>>> 
1267650600228229401496703205376
['C:\\pyclass', 'C:\\Python27\\Lib\\idlelib', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']

Traceback (most recent call last):
  File "C:\pyclass\script1.py", line 5, in <module>
    x = 'NI' + Z
NameError: name 'Z' is not defined
>>> 
>>> 
>>> S = 'spam'
>>> len(S)
4
>>> S[0]
's'
>>> S[1]
'p'
>>> 
>>> S[-1]
'm'
>>> S[-2]
'a'
>>> S
'spam'
>>> S[-3]
'p'
>>> S[-4]
's'
>>> S[3]
'm'
>>> S[len(S)-4]
's'
>>> S
'spam'
>>> 
>>> S[1:3]
'pa'
>>> S[1:]
'pam'
>>> S[:3]
'spa'
>>> S[:-1]
'spa'
>>> S[1:1000]
'pam'
>>> S[1000]

Traceback (most recent call last):
  File "<pyshell#27>", line 1, in <module>
    S[1000]
IndexError: string index out of range
>>> 
>>> S
'spam'
>>> S + 'NI'
'spamNI'
>>> 
>>> S * 8
'spamspamspamspamspamspamspamspam'
>>> 
>>> S.upper()
'SPAM'
>>> S
'spam'
>>> S.replace('pa', 'XYZ')
'sXYZm'
>>> 
>>> S.find('pa')
1
>>> dir(S)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
>>> 
>>> 
>>> line = 'abcdefg\n'
>>> line[:-1]
'abcdefg'
>>> line.rstrip()
'abcdefg'
>>> line.rstrip()
KeyboardInterrupt
>>> line = 'abc,def,g\n'
>>> line.split(',')
['abc', 'def', 'g\n']
>>> 
>>> help(line.split)
Help on built-in function split:

split(...)
    S.split([sep [,maxsplit]]) -> list of strings
    
    Return a list of the words in the string S, using sep as the
    delimiter string.  If maxsplit is given, at most maxsplit
    splits are done. If sep is not specified or is None, any
    whitespace string is a separator and empty strings are removed
    from the result.

>>> help("if")
The ``if`` statement
********************

The ``if`` statement is used for conditional execution:

   if_stmt ::= "if" expression ":" suite
               ( "elif" expression ":" suite )*
               ["else" ":" suite]

It selects exactly one of the suites by evaluating the expressions one
by one until one is found to be true (see section *Boolean operations*
for the definition of true and false); then that suite is executed
(and no other part of the ``if`` statement is executed or evaluated).
If all expressions are false, the suite of the ``else`` clause, if
present, is executed.

Related help topics: TRUTHVALUE

>>> import os
>>> dir(os)
KeyboardInterrupt
>>> help(os.getcwd)
Help on built-in function getcwd in module nt:

getcwd(...)
    getcwd() -> path
    
    Return a string representing the current working directory.

>>> line.count
<built-in method count of str object at 0x00000000035975D0>
>>> 
>>> line = 'abc,def,g\n'
>>> line.rstrip()
'abc,def,g'
>>> line
'abc,def,g\n'
>>> line = line.rstrip()
>>> line
'abc,def,g'
>>> 
>>> line = 'abc,def,g\n'
>>> X = line
>>> line = line.rstrip()
>>> line
'abc,def,g'
>>> X
'abc,def,g\n'
>>> line[0] = '?'

Traceback (most recent call last):
  File "<pyshell#65>", line 1, in <module>
    line[0] = '?'
TypeError: 'str' object does not support item assignment
>>> 
>>> L = [123, 'spam', 1.23]
>>> len(L)
3
>>> L + [4, 5, 6]
[123, 'spam', 1.23, 4, 5, 6]
>>> L * 3
[123, 'spam', 1.23, 123, 'spam', 1.23, 123, 'spam', 1.23]
>>> L[0]
123
>>> L[-1]
1.23
>>> L[1:]
['spam', 1.23]
>>> L
[123, 'spam', 1.23]
>>> L.insert(1, 99)
>>> L
[123, 99, 'spam', 1.23]
>>> L.extend([4, 5])
>>> L
[123, 99, 'spam', 1.23, 4, 5]
>>> L.remove(99)
>>> L
[123, 'spam', 1.23, 4, 5]
>>> L.pop(2)
1.23
>>> L
[123, 'spam', 4, 5]
>>> 
>>> 
>>> M = [[1, 2, 3],
         [4, 5, 6],
         [7, 8, 9]]
>>> M
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
>>> M[1]
[4, 5, 6]
>>> M[1][2]
6
>>> M[1][-1]
6
>>> M[1][-1] = 0
>>> M
[[1, 2, 3], [4, 5, 0], [7, 8, 9]]
>>> 
>>> L = [123, 'spam', 1.23]
>>> L
[123, 'spam', 1.23]
>>> L[1]
'spam'
>>> L[1] = 99
>>> L
[123, 99, 1.23]
>>> 
>>> col2 = [row[1] for row in M]
>>> col2
[2, 5, 8]
>>> col2 = [row[1] ** 2 for row in M]
>>> col2
[4, 25, 64]
>>> 
>>> T = (1, 2, 3, 4)
>>> T
(1, 2, 3, 4)
>>> 
>>> D = {'a': 1, 'b': 2, 'c': 3}
>>> D['b']
2
>>> D['xxx'] = 'spam'
>>> D
{'a': 1, 'c': 3, 'b': 2, 'xxx': 'spam'}
>>> 
>>> D = {'name': 'bob', 'age': 40, 'job': 'dev'}
>>> D
{'job': 'dev', 'age': 40, 'name': 'bob'}
>>> D['name']
'bob'
>>> 
>>> rec = {'name': {'first': 'Bob', 'last': 'Smith'},
           'age': 40.5,
           'job': ['dev', 'mgr']}
>>> rec['name']
{'last': 'Smith', 'first': 'Bob'}
>>> rec['name']['last']
'Smith'
>>> rec['job']
['dev', 'mgr']
>>> rec['job'].append('janitor')
>>> rec
{'job': ['dev', 'mgr', 'janitor'], 'age': 40.5, 'name': {'last': 'Smith', 'first': 'Bob'}}
>>> rec = 0
>>> rec
0
>>> 
>>> 
>>> D = {'spam': 1, 99: 2, (3, 4, 5): 6}
>>> D['spam']
1
>>> D[99]
2
>>> D[(3, 4, 5)]
6
>>> D = {'a':1, 'b':2}
>>> 
>>> 
>>> D['c'] = 3
>>> D
{'a': 1, 'c': 3, 'b': 2}
>>> D['d']

Traceback (most recent call last):
  File "<pyshell#142>", line 1, in <module>
    D['d']
KeyError: 'd'
>>> 
>>> if not D.has_key('d'):
	print 'missing'

	
missing
>>> 
>>> D.get('d', 'missing')
'missing'
>>> 
>>> 
>>> D = {'a': 1, 'b': 2, 'c': 3}
>>> D
{'a': 1, 'c': 3, 'b': 2}
>>> 
>>> D.keys()
['a', 'c', 'b']
>>> Ks = D.keys()
>>> Ks
['a', 'c', 'b']
>>> Ks.sort()
>>> Ks
['a', 'b', 'c']
>>> 
>>> for key in Ks:
	print key, '=>', D[key]

	
a => 1
b => 2
c => 3
>>> 
>>> [D[key] for key in Ks]
[1, 2, 3]
>>> 
>>> 0b101010
42
>>> bin(42)
'0b101010'
>>> 
>>> 
>>> 
>>> X = 99
>>> X = 'spam'
>>> X
'spam'
>>> 
>>> 
>>> L = [1, 2, 3]
>>> M = [1, 2, 3]
>>> L == M
True
>>> L is M
False
>>> 
>>> L = [1, 2, 3]
>>> M = L
>>> L == M
True
>>> M is L
True
>>> 
>>> X = 99
>>> Y = 99
>>> X == Y
True
>>> X is Y
True
>>> 
>>> import sys
>>> sys.getrefcount(1)
810
>>> 
>>> 
>>> S = 'A\nB\tC'
>>> 
>>> len(S)
5
>>> ord('\n')
10
>>> 
>>> M = '''
aaaaaaaaaa
bbbb"""bbbbb''bb
ccccc'''
>>> 
>>> M
'\naaaaaaaaaa\nbbbb"""bbbbb\'\'bb\nccccc'
>>> print M

aaaaaaaaaa
bbbb"""bbbbb''bb
ccccc
>>> 
>>> 
>>> F = open('data.txt', 'w')
>>> F.write('hello\n')
>>> F.write('world\n')
>>> F.close()
>>> 
>>> F = open('data.txt')
>>> data = F.read()
>>> data
'hello\nworld\n'
>>> print data
hello
world

>>> F = open('data.txt')
>>> F.readline()
'hello\n'
>>> F.readline()
'world\n'
>>> F.readline()
''
>>> F = open('data.txt')
>>> F.read(10)
'hello\nworl'
>>> F.read(10)
'd\n'
>>> F.read(10)
''
>>> F.seek(N) 
KeyboardInterrupt
>>> help(F.seek)
Help on built-in function seek:

seek(...)
    seek(offset[, whence]) -> None.  Move to new file position.
    
    Argument offset is a byte count.  Optional argument whence defaults to
    0 (offset from start of file, offset should be >= 0); other values are 1
    (move relative to current position, positive or negative), and 2 (move
    relative to end of file, usually negative, although many platforms allow
    seeking beyond the end of a file).  If the file is opened in text mode,
    only offsets returned by tell() are legal.  Use of other offsets causes
    undefined behavior.
    Note that not all file objects are seekable.

>>> 
>>> L
[1, 2, 3]
>>> 
>>> type(L)
<type 'list'>
>>> 
>>> X = None
>>> 
>>> L = []
>>> L[99] = 1

Traceback (most recent call last):
  File "<pyshell#241>", line 1, in <module>
    L[99] = 1
IndexError: list assignment index out of range
>>> L = [None] * 100
>>> L
[None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]
>>> 
>>> 
>>> x = raw_input('enter=>')
enter=>spam
>>> x
'spam'
>>> 
>>> int('99')
99
>>> int('101010', 2)
42
>>> int('FFF', 16)
4095
>>> 
>>> 42 + '1'

Traceback (most recent call last):
  File "<pyshell#253>", line 1, in <module>
    42 + '1'
TypeError: unsupported operand type(s) for +: 'int' and 'str'
>>> 
>>> str(42) + '1'
'421'
>>> 
>>> 42 + int('1')
43
>>> ================================ RESTART ================================
>>> 
Your age40
1600
Your age5
25
Your agestop
bye
>>> ================================ RESTART ================================
>>> 
Your age8
64
Your agespam

Traceback (most recent call last):
  File "C:/pyclass/interact.py", line 4, in <module>
    print int(inp) ** 2
ValueError: invalid literal for int() with base 10: 'spam'
>>> 
>>> s = '123'
>>> s.isdigit()
True
>>> ================================ RESTART ================================
>>> 
Your age7
49
Your agespam
Bad!Bad!Bad!Bad!Bad!Bad!Bad!Bad!
Your age8
64
Your agestop
bye
>>> ================================ RESTART ================================
>>> 
Your age7
49
Your age7.9
Bad!Bad!Bad!Bad!Bad!Bad!Bad!Bad!
Your age
>>> ================================ RESTART ================================
>>> 

Your age:9
81
Your age:7
49
Your age:spam
Bad!Bad!Bad!Bad!Bad!Bad!Bad!Bad!
Your age:7
49
Your age:stop
bye
>>> ================================ RESTART ================================
>>> 
Your age:9
81.0
Your age:1.25
1.5625
Your age:5.5
30.25
Your age:sss
Bad!Bad!Bad!Bad!Bad!Bad!Bad!Bad!
Your age:stop
bye
>>> ================================ RESTART ================================
>>> 
Your age:6.5
42.25
Your age:2 ** 4
256
Your age:[1, 2, 3][2] * 2
36
Your age:stop
bye
>>> 
>>> X = Y = 0
>>> X = X + 1
>>> X
1
>>> Y
0
>>> X = Y = []
>>> X.append(1)
>>> X
[1]
>>> Y
[1]
>>> X, Y = [], []
>>> X.append(1)
>>> X
[1]
>>> Y
[]
>>> X++   --X
KeyboardInterrupt
>>> 
>>> X += 1
>>> 
>>> 
>>> and = 1
SyntaxError: invalid syntax
>>> 
>>> 
>>> 
>>> 
>>> mn = __import__('M N')    
KeyboardInterrupt
>>> 
>>> 
>>> L = [1, 2, 3]
>>> L.append(4)
>>> L
[1, 2, 3, 4]
>>> 
>>> L = L.append(5)
>>> print L
None
>>> 
>>> D = {'a': 1, 'b': 2, 'c': 3}
>>> D
{'a': 1, 'c': 3, 'b': 2}
>>> 
>>> for key in D.keys().sort():
	print key, D[key]

	

Traceback (most recent call last):
  File "<pyshell#297>", line 1, in <module>
    for key in D.keys().sort():
TypeError: 'NoneType' object is not iterable
>>> 
>>> for key in sorted(D.keys()):
	print key, D[key]

	
a 1
b 2
c 3
>>> for key in sorted(D):
	print key, D[key]

	
a 1
b 2
c 3
>>> 
>>> 
>>> import sys
>>> print >> sys.stderr, 'Bad!' * 8
Bad!Bad!Bad!Bad!Bad!Bad!Bad!Bad!
>>> 
>>> print >> open('errors', 'w'), 'Bad!' * 8
>>> 
>>> print open('errors').read()
Bad!Bad!Bad!Bad!Bad!Bad!Bad!Bad!

>>> open('xxx', 'w').write(...)  
KeyboardInterrupt
>>> 
>>> 
>>> ord('s')
115
>>> ord('spam')

Traceback (most recent call last):
  File "<pyshell#317>", line 1, in <module>
    ord('spam')
TypeError: ord() expected a character, but string of length 4 found
>>> 
>>> 
>>> import docstrings
>>> print docstrings.__doc__

Module documentation
Words Go Here

>>> print docstrings.square.__doc__

    function documentation
    can we have your liver then?
    
>>> 
>>> help(docstrings)
Help on module docstrings:

NAME
    docstrings

FILE
    c:\pyclass\docstrings.py

DESCRIPTION
    Module documentation
    Words Go Here

FUNCTIONS
    square(x)
        function documentation
        can we have your liver then?

DATA
    spam = 40


>>> help(docstrings.square)
Help on function square in module docstrings:

square(x)
    function documentation
    can we have your liver then?

>>> 
>>> F = open('script1.py')
>>> F.readline()
'# first script\n'
>>> F.readline()
'print 2 ** 100\n'
>>> F.readline()
'import sys\n'
>>> F.readline()
'print sys.path       # import search path\n'
>>> F.readline()
"x = 'NI' + Z\n"
>>> F.readline()
"print 'spam' + x\n"
>>> F.readline()
'\n'
>>> F.readline()
''
>>> 
>>> F = open('script1.py')
>>> F.next()
'# first script\n'
>>> F.next()
'print 2 ** 100\n'
>>> F.next()
'import sys\n'
>>> F.next()
'print sys.path       # import search path\n'
>>> F.next()
"x = 'NI' + Z\n"
>>> F.next()
"print 'spam' + x\n"
>>> F.next()
'\n'
>>> F.next()

Traceback (most recent call last):
  File "<pyshell#346>", line 1, in <module>
    F.next()
StopIteration
>>> 
>>> for line in open('script1.py'):
	print line.upper(),

	
# FIRST SCRIPT
PRINT 2 ** 100
IMPORT SYS
PRINT SYS.PATH       # IMPORT SEARCH PATH
X = 'NI' + Z
PRINT 'SPAM' + X

>>> for line in open('script1.py').readlines():
	print line.upper(),

	
# FIRST SCRIPT
PRINT 2 ** 100
IMPORT SYS
PRINT SYS.PATH       # IMPORT SEARCH PATH
X = 'NI' + Z
PRINT 'SPAM' + X

>>> F = open('script1.py')
>>> while True:
	line = F.readline()
	if not line: break
	print line.upper(),

	
# FIRST SCRIPT
PRINT 2 ** 100
IMPORT SYS
PRINT SYS.PATH       # IMPORT SEARCH PATH
X = 'NI' + Z
PRINT 'SPAM' + X

>>> D
{'a': 1, 'c': 3, 'b': 2}
>>> 
>>> for key in D: print key, D[key]

a 1
c 3
b 2
>>> D.next()

Traceback (most recent call last):
  File "<pyshell#363>", line 1, in <module>
    D.next()
AttributeError: 'dict' object has no attribute 'next'
>>> 
>>> I = iter(D)
>>> I.next()
'a'
>>> I.next()
'c'
>>> I.next()
'b'
>>> I.next()

Traceback (most recent call last):
  File "<pyshell#371>", line 1, in <module>
    I.next()
StopIteration
>>> 
>>> 
>>> S = 'abcdefghijklmnop'
>>> 
>>> S[::2]
'acegikmo'
>>> S[1::2]
'bdfhjlnp'
>>> S[::-1]
'ponmlkjihgfedcba'
>>> 
>>> 
>>> L = [1, 2, 3, 4, 5]
>>> for x in L:
	x += 10

	
>>> L
[1, 2, 3, 4, 5]
>>> x
15
>>> for i in range(len(L)):
	L[i] += 10

	
>>> L
[11, 12, 13, 14, 15]
>>> 
>>> M = [X + 10 for X in L]
>>> M
[21, 22, 23, 24, 25]
>>> 
>>> res = []
>>> for X in L:
	res.append(X + 10)

	
>>> res
[21, 22, 23, 24, 25]
>>> 
>>> map(ord, 'spam')
[115, 112, 97, 109]
>>> 
>>> def f(X): return X + 10

>>> f(1)
11
>>> map(f, L)
[21, 22, 23, 24, 25]
>>> 
>>> F = open('script1.py')
>>> lines = F.readlines()
>>> lines
['# first script\n', 'print 2 ** 100\n', 'import sys\n', 'print sys.path       # import search path\n', "x = 'NI' + Z\n", "print 'spam' + x\n", '\n']
>>> lines = [line.rstrip() for line in lines]
>>> lines
['# first script', 'print 2 ** 100', 'import sys', 'print sys.path       # import search path', "x = 'NI' + Z", "print 'spam' + x", '']
>>> 
>>> lines = [line.rstrip() for line in open('script1.py')]
>>> lines
['# first script', 'print 2 ** 100', 'import sys', 'print sys.path       # import search path', "x = 'NI' + Z", "print 'spam' + x", '']
>>> 
>>> lines = [line.rstrip() for line in open('script1.py') if line[0] == 'p']
>>> lines
['print 2 ** 100', 'print sys.path       # import search path', "print 'spam' + x"]
>>> 
>>> [x + y for x in 'abc' for y in 'xyz']
['ax', 'ay', 'az', 'bx', 'by', 'bz', 'cx', 'cy', 'cz']
>>> 
>>> res = []
>>> for x in 'abc':
	for y in 'xyz':
		res.append(x + y)

		
>>> res
['ax', 'ay', 'az', 'bx', 'by', 'bz', 'cx', 'cy', 'cz']
>>> 
>>> res = []
>>> for line in open('script1.py'):
	if line[0] == 'p':
		res.append(line.rstrip())

		
>>> res
['print 2 ** 100', 'print sys.path       # import search path', "print 'spam' + x"]
>>> [ord(c) for c in 'spam']
[115, 112, 97, 109]
>>> map(ord, 'spam')
[115, 112, 97, 109]
>>> 
>>> 
>>> zip('abc', 'xz', 'lmn')
[('a', 'x', 'l'), ('b', 'z', 'm')]
>>> 
>>> map(None, 'abc', 'xz', 'lmn')
[('a', 'x', 'l'), ('b', 'z', 'm'), ('c', None, 'n')]
>>> 
>>> 
>>> 
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> 
>>> xrange(1000000) 
KeyboardInterrupt
>>> 
>>> 
>>> 
>>> import __builtin__
>>> dir(__builtin__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BufferError', 'BytesWarning', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']
>>> 
>>> True = False
>>> True
False
>>> 
>>> open = 42
>>> open
42
>>> del open
>>> open
<built-in function open>
>>> 
>>> 
>>> def maker(N):
	def action(X):
		return X ** N
	return action

>>> F = maker(3)
>>> F
<function action at 0x0000000003957F28>
>>> 
>>> F(2)
8
>>> G = maker(10)
>>> G(2)
1024
>>> 
>>> F(2)
8
>>> def F(a, b, c): print a, b, c

>>> F(1, 2, 3)
1 2 3
>>> 
>>> 
>>> def F(*args): print args

>>> F(1, 2, 3)
(1, 2, 3)
>>> F(1)
(1,)
>>> F()
()
>>> 
>>> def sumit(*args):
	tot = 0
	for x in args: tot += x
	return tot

>>> 
>>> sumit(1, 2, 3, 4, 5)
15
>>> 
>>> 
>>> def sumit(*args):
	tot = args[0]
	for x in args[1:]: tot += x
	return tot

>>> sumit(1, 2, 3, 4, 5)
15
>>> sumit('aa', 'bb', 'cc')
'aabbcc'
>>> 
>>> 
>>> fname = 'script1.py'
>>>
>>> len( open(fname).readlines() )
7
>>> 
>>> len( open(fname).read() )
114
>>> 
>>> tot = 0
>>> for line in open(fname): tot += 1

>>> tot
7
>>> tot = 0
>>> for line in open(fname): tot += len(line)

>>> tot
114
>>> 
>>> 
>>> X = 9
>>> X.__add__(8)
17
>>> X + 8
17
>>> X = 10
>>> import struct
>>> 
>>> 
>>> ================================ RESTART ================================
>>> 
Bob Smith Sue Jones
>>> name = 'Bob Smith'
>>> name.split()
['Bob', 'Smith']
>>> name.split()[-1]
'Smith'
>>> ================================ RESTART ================================
>>> 
Bob Smith Sue Jones
Smith
110000.0
>>> ================================ RESTART ================================
>>> 
Bob Smith Sue Jones
Smith Jones
110000.0
>>> ================================ RESTART ================================
>>> 
Bob Smith Sue Jones
Smith Jones
110000.0
<__main__.Person instance at 0x00000000036DD848>
>>> ================================ RESTART ================================
>>> 
[Person: Bob Smith, 0]
[Person: Sue Jones, 100000]
Smith Jones
[Person: Sue Jones, 110000.0]
>>> ================================ RESTART ================================
>>> 
[Person: Bob Smith, 0]
[Person: Sue Jones, 100000]
Smith Jones
[Person: Sue Jones, 110000.0]
Jones
[Person: Tom Jones, 60000.0]
>>> ================================ RESTART ================================
>>> 
[Person: Bob Smith, 0]
[Person: Sue Jones, 100000]
Smith Jones
[Person: Sue Jones, 110000.0]
Jones
[Manager: Tom Jones, 60000.0]
>>> ================================ RESTART ================================
>>> 
[Person: Bob Smith, 0]
[Person: Sue Jones, 100000]
Smith Jones
[Person: Sue Jones, 110000.0]
Jones
[Manager: Tom Jones, 60000.0]
>>> ================================ RESTART ================================
>>> 
>>> import glob
>>> glob.glob(r':\pyclass\*')
[]
>>> glob.glob(r'C:\pyclass\*')
['C:\\pyclass\\ciscodb', 'C:\\pyclass\\data.txt', 'C:\\pyclass\\docstrings.py', 'C:\\pyclass\\docstrings.pyc', 'C:\\pyclass\\errors', 'C:\\pyclass\\interact.py', 'C:\\pyclass\\makedb.py', 'C:\\pyclass\\person.py', 'C:\\pyclass\\person.pyc', 'C:\\pyclass\\script1.py']
>>> 

>>> open(r'C:\pyclass\ciscodb').read()[:500]
'\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00a\x15\x06\x00\t\x00\x00\x00\x00 \x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa3U\x02\x00\x00\x00\x14\x00\x1e\xe8Z(\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\x8dh^\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
>>> 

>>> import shelve
>>> db = shelve.open(r'C:\pyclass\ciscodb')
>>> len(db)
3
>>> db.keys()
['tom', 'bob', 'sue']
>>> 
>>> bob = db['bob']
>>> print bob
[Person: Bob Smith, 0]
>>> bob.lastName()
'Smith'
>>> bob.job
>>> print bob.job
None
>>> 
>>> for key in db:
	print key, '=>', db[key]

	
tom => [Manager: Tom Jones, 50000]
bob => [Person: Bob Smith, 0]
sue => [Person: Sue Jones, 100000]
>>> ================================ RESTART ================================
>>> 
tom => [Manager: Tom Jones, 50000]
bob => [Person: Bob Smith, 0]
sue => [Person: Sue Jones, 100000]
>>> ================================ RESTART ================================
>>> 
tom => [Manager: Tom Jones, 50000]
bob => [Person: Bob Smith, 0]
sue => [Person: Sue Jones, 110000.0]
>>> ================================ RESTART ================================
>>> 
tom => [Manager: Tom Jones, 50000]
bob => [Person: Bob Smith, 0]
sue => [Person: Sue Jones, 121000.0]
>>> ================================ RESTART ================================
>>> 
tom => [Manager: Tom Jones, 50000]
bob => [Person: Bob Smith, 0]
sue => [Person: Sue Jones, 133100.0]
>>> ================================ RESTART ================================
>>> 
tom => [Manager: Tom Jones, 50000]
bob => [Person: Bob Smith, 0]
sue => [Person: Sue Jones, 146410.0]
>>> ================================ RESTART ================================
>>> 
tom => [Manager: Tom Jones, 50000]
bob => [Person: Bob Smith, 0]
sue => [Person: Sue Jones, 161051.0]
>>> 
>>> 
>>> help(IOError)
Help on class IOError in module exceptions:

class IOError(EnvironmentError)
 |  I/O operation failed.
 |  
 |  Method resolution order:
 |      IOError
 |      EnvironmentError
 |      StandardError
 |      Exception
 |      BaseException
 |      __builtin__.object
 |  
 |  Methods defined here:
 |  
 |  __init__(...)
 |      x.__init__(...) initializes x; see help(type(x)) for signature
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  __new__ = <built-in method __new__ of type object>
 |      T.__new__(S, ...) -> a new object with type S, a subtype of T
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from EnvironmentError:
 |  
 |  __reduce__(...)
 |  
 |  __str__(...)
 |      x.__str__() <==> str(x)
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from EnvironmentError:
 |  
 |  errno
 |      exception errno
 |  
 |  filename
 |      exception filename
 |  
 |  strerror
 |      exception strerror
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from BaseException:
 |  
 |  __delattr__(...)
 |      x.__delattr__('name') <==> del x.name
 |  
 |  __getattribute__(...)
 |      x.__getattribute__('name') <==> x.name
 |  
 |  __getitem__(...)
 |      x.__getitem__(y) <==> x[y]
 |  
 |  __getslice__(...)
 |      x.__getslice__(i, j) <==> x[i:j]
 |      
 |      Use of negative indices is not supported.
 |  
 |  __repr__(...)
 |      x.__repr__() <==> repr(x)
 |  
 |  __setattr__(...)
 |      x.__setattr__('name', value) <==> x.name = value
 |  
 |  __setstate__(...)
 |  
 |  __unicode__(...)
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from BaseException:
 |  
 |  __dict__
 |  
 |  args
 |  
 |  message

>>> 
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>> 
