Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 2 ** 500
3273390607896141870013189696827599152216642046043064789483291368096133796404674554883270092325904157150886684127560071009217256545885393053328527589376L
>>> 
>>> 'spam' + 'ni'
'spamni'
>>> 
>>> 2 + 4
6
>>> 
>>> import os
>>> os.getcwd()
'C:\\Python27'
>>> ================================ RESTART ================================
>>> 
18446744073709551616
win32
spamNI!
>>> ================================ RESTART ================================
>>> 
18446744073709551616
win32

Traceback (most recent call last):
  File "C:\pyclass\script1.py", line 4, in <module>
    x = 'spam' + Z
NameError: name 'Z' is not defined
>>> 
>>> import os
>>> os.chdir('C:\\pyclass')
>>> 
>>> import script1
18446744073709551616
win32

Traceback (most recent call last):
  File "<pyshell#14>", line 1, in <module>
    import script1
  File "C:\pyclass\script1.py", line 4, in <module>
    x = 'spam' + Z
NameError: name 'Z' is not defined
>>>
>>> import script1
18446744073709551616
win32
spamNI!
>>> import script1
>>> import script1
>>> import script1
>>> 
>>> reload(script1)
18446744073709551616
win32
spamNI!
<module 'script1' from 'C:\pyclass\script1.pyc'>
>>> 
>>> ================================ RESTART ================================
>>> 
4562440617622195218641171605700291324893228507248559930579192517899275167208677386505912811317371399778642309573594407310688704721375437998252661319722214188251994674360264950082874192246603776
win32
spamNI!
>>>
>>>
>>> "bob's"
"bob's"
>>> 
>>> 
>>> 'bob\'s'
"bob's"
>>> 
>>> 
>>> 
>>> import sys
>>> sys.path
['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']
>>> 
>>>
>>>
>>>
>>> S = 'spam'
>>> len(S)
4
>>> S + 'ni'
'spamni'
>>> S * 8
'spamspamspamspamspamspamspamspam'
>>> 
>>> S[0]
's'
>>> S[1]
'p'
>>> S[-1]
'm'
>>> S[-2]
'a'
>>> S[len(S) - 1]
'm'
>>> S[-1]
'm'
>>> 
>>> S
'spam'
>>> 
>>> S[1:3]
'pa'
>>> S[1:]
'pam'
>>> S[:-1]
'spa'
>>> S
'spam'
>>> S[:]
'spam'
>>> 
>>> S = 'abcdefghijklmnop'
>>> S[::2]
'acegikmo'
>>>
>>> S[1::2]
'bdfhjlnp'
>>>
>>> S[::-1]
'ponmlkjihgfedcba'
>>> 
>>> S
'abcdefghijklmnop'
>>> 
>>> S.find('def')
3
>>> line = 'aaa,bbb,ccc\n'
>>> 
>>> line.rstrip()
'aaa,bbb,ccc'
>>> 
>>> line[:-1]
'aaa,bbb,ccc'
>>> 
>>> line
'aaa,bbb,ccc\n'
>>> line.split(',')
['aaa', 'bbb', 'ccc\n']
>>> 
>>> line.rstrip().split(',')
['aaa', 'bbb', 'ccc']
>>> 
>>> line.upper()
'AAA,BBB,CCC\n'
>>> 
>>> dir(line)
['__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']
>>> 
>>> S + 'XXX'
'abcdefghijklmnopXXX'
>>> 
>>> S.__add__('XXX')
'abcdefghijklmnopXXX'
>>> 
>>> line
'aaa,bbb,ccc\n'
>>> 
>>> line.replace(',', '$$$')
'aaa$$$bbb$$$ccc\n'
>>> 
>>> 
>>> '$$$'.join(line.split(','))
'aaa$$$bbb$$$ccc\n'
>>> 
>>> help(line.join)
Help on built-in function join:

join(...)
    S.join(iterable) -> string
    
    Return a string which is the concatenation of the strings in the
    iterable.  The separator between elements is S.

>>> 
>>> L = [123, 'aaa', 1.23]
>>> 
>>> len(L)
3
>>> L + [4, 5, 6]
[123, 'aaa', 1.23, 4, 5, 6]
>>> 
>>> L * 3
[123, 'aaa', 1.23, 123, 'aaa', 1.23, 123, 'aaa', 1.23]
>>> 
>>> L[0]
123
>>> L[-1]
1.23
>>> 
>>> L[1:]
['aaa', 1.23]
>>> 
>>>
>>> line
'aaa,bbb,ccc\n'
>>> line.replace(',', '$$$')
'aaa$$$bbb$$$ccc\n'
>>> line
'aaa,bbb,ccc\n'
>>> line = line.replace(',', '$$$')
>>> line
'aaa$$$bbb$$$ccc\n'
>>> line[0] = 'x'

Traceback (most recent call last):
  File "<pyshell#107>", line 1, in <module>
    line[0] = 'x'
TypeError: 'str' object does not support item assignment
>>> 
>>> L
[123, 'aaa', 1.23]
>>> L[0] = 999
>>> L
[999, 'aaa', 1.23]
>>> 
>>> L.append(456)
>>> L
[999, 'aaa', 1.23, 456]
>>> L.insert(1, 888)
>>> L
[999, 888, 'aaa', 1.23, 456]
>>> L.remove(888)
>>> L
[999, 'aaa', 1.23, 456]
>>> dir(L)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
>>> 
>>> 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
>>> 
>>> [row[1] for row in M]
[2, 5, 8]
>>> 
>>> [x ** 2 for x in [1, 2, 3, 4, 5]]
[1, 4, 9, 16, 25]
>>> 
>>> ord('x')
120
>>> 
>>> [ord(c) for c in 'spam']
[115, 112, 97, 109]
>>> 
>>> 
>>> D = {'food':'spam', 'taste':'yum'}
>>> 
>>> 
>>> D['food']
'spam'
>>> D['age'] = 100
>>> D
{'food': 'spam', 'taste': 'yum', 'age': 100}
>>> 
>>> D = {}
>>> D['name'] = 'Bob'
>>> D['job']  = 'dev'
>>> D['age']  = 40
>>> 
>>> D
{'age': 40, 'job': 'dev', 'name': 'Bob'}
>>> 
>>> rec = {'name': {'first': 'Bob', 'last': 'Smith'},
           'job':  ['dev', 'mgr'],
           'age':  40.5}
>>> 
>>> rec['name']
{'last': 'Smith', 'first': 'Bob'}
>>> rec['name']['last']
'Smith'
>>> rec['job']
['dev', 'mgr']
>>> rec['job'][-1]
'mgr'
>>> rec['job'].append('janitor')
>>> rec
{'age': 40.5, 'job': ['dev', 'mgr', 'janitor'], 'name': {'last': 'Smith', 'first': 'Bob'}}
>>> 
>>>
>>> import pprint
>>> pprint.pprint(rec)
{'age': 40.5,
 'job': ['dev', 'mgr', 'janitor'],
 'name': {'first': 'Bob', 'last': 'Smith'}}
>>>
>>> 
>>> {'a':1, 'b':2, 'c':3}
{'a': 1, 'c': 3, 'b': 2}
>>> 
>>> D = {'a':1, 'b':2, 'c':3}
>>> D
{'a': 1, 'c': 3, 'b': 2}
>>> Ks = D.keys()
>>> Ks
['a', 'c', 'b']
>>> Ks.sort()
>>> Ks
['a', 'b', 'c']
>>> 
>>> 
>>> rec = {'name': {'first': 'Bob', 'last': 'Smith'},
           'job':  ['dev', 'mgr'],
           'age':  40.5}
>>> 
>>> import json
>>> json.dumps(rec)
'{"age": 40.5, "job": ["dev", "mgr"], "name": {"last": "Smith", "first": "Bob"}}'
>>> pprint.pprint(json.dumps(rec))
'{"age": 40.5, "job": ["dev", "mgr"], "name": {"last": "Smith", "first": "Bob"}}'
>>> 
>>> JS = json.dumps(rec)
>>> JS
'{"age": 40.5, "job": ["dev", "mgr"], "name": {"last": "Smith", "first": "Bob"}}'
>>> 
>>> json.loads(JS)
{u'age': 40.5, u'job': [u'dev', u'mgr'], u'name': {u'last': u'Smith', u'first': u'Bob'}}
>>> 
>>> rec = 0
>>>
>>> 
>>> F = open('data.txt', 'w')
>>> F.write('Hello\n')
>>> F.write('world.\n')
>>> F.close()
>>> 
>>> F = open('data.txt')
>>> bytes = F.read()
>>> bytes
'Hello\nworld.\n'
>>> 
>>> print bytes
Hello
world.

>>> F = open('data.txt', 'rb')
>>> bytes = F.read()
>>> bytes
'Hello\r\nworld.\r\n'
>>> 
>>>
>>> import time
>>> dir(time)
['__doc__', '__name__', '__package__', 'accept2dyear', 'altzone', 'asctime', 'clock', 'ctime', 'daylight', 'gmtime', 'localtime', 'mktime', 'sleep', 'strftime', 'strptime', 'struct_time', 'time', 'timezone', 'tzname']
>>>
>>> import datetime
>>> dir(datetime)
['MAXYEAR', 'MINYEAR', '__doc__', '__name__', '__package__', 'date', 'datetime', 'datetime_CAPI', 'time', 'timedelta', 'tzinfo']
>>> 
>>>
>>> '%s -- %s -- %s' % (123, 'spam', [4, 5, 6])
'123 -- spam -- [4, 5, 6]'
>>> 
>>> '%(a)s -- %(b)s -- %(c)s' % {'a': 123, 'b': 'spam', 'c': [4, 5, 6]}
'123 -- spam -- [4, 5, 6]'
>>> 
>>> rec = {'name': {'first': 'Bob', 'last': 'Smith'},
           'job':  ['dev', 'mgr'],
           'age':  40.5}
>>> 
>>> '%(name)s -- %(age)s -- %(job)s' % rec
"{'last': 'Smith', 'first': 'Bob'} -- 40.5 -- ['dev', 'mgr']"
>>> 
>>>
>>> 
>>> json.loads('{"bad": [$]}')

Traceback (most recent call last):
  File "<pyshell#226>", line 1, in <module>
    json.loads('{"bad": [$]}')
  File "C:\Python27\lib\json\__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
>>> 
>>> 
>>> 
>>> import math
>>> math.sqrt(9)
3.0
>>> 
>>> 
>>> 0b1010101010
682
>>> 0177
127
>>> 0o177
127
>>> 0xFF
255
>>> bin(682)
'0b1010101010'
>>> 
>>> 
>>> hex(255)
'0xff'
>>> 
>>>
>>> 
>>> X = 'spam'
>>> X = 99
>>> 
>>> 
>>> 
>>> L = [1, 2, 3, 4]
>>> M = [1, 2, 3, 4]
>>> 
>>> L == M
True
>>> L is M
False
>>> 
>>> L = [1, 2, 3, 4]
>>> M = L
>>> 
>>> L == M
True
>>> L is M
True
>>> 
>>> msg = """
aaaaaaaaaaaaa
bbbbbbbb'''bb""bbbbbb
ccccccccccc"""
>>> 
>>> msg
'\naaaaaaaaaaaaa\nbbbbbbbb\'\'\'bb""bbbbbb\nccccccccccc'
>>>
>>> open(r'C:\new\text')   
KeyboardInterrupt
>>> 
>>> import codecs
>>> codecs.open(
KeyboardInterrupt
>>> 
>>> 
>>> 
>>> 
>>> S = u'A\xC4B'
>>> print S
AB
>>> codecs.open('uni.txt', 'w', 'utf-8').write(S)
>>> open('uni.txt', 'rb').read()
'A\xc3\x84B'
>>> 
>>> codecs.open('uni.txt', 'r', 'utf-8').read()
u'A\xc4B'
>>> print codecs.open('uni.txt', 'r', 'utf-8').read()
AB
>>> 
>>> S
u'A\xc4B'
>>> S.encode('latin-1')
'A\xc4B'
>>> S.encode('utf-8')
'A\xc3\x84B'
>>> S.encode('utf-16')
'\xff\xfeA\x00\xc4\x00B\x00'
>>> 
>>> X = S.encode('utf-16')
>>> X
'\xff\xfeA\x00\xc4\x00B\x00'
>>> X.decode('utf-16')
u'A\xc4B'
>>> print X.decode('utf-16')
AB
>>> 
>>> 
>>> D = {}
>>> D['a'] = 1
>>> D['a']
1
>>> 
>>> D['b']

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

	
missing...
>>> 
>>> D = {'a': 1, 'b': 2, 'c': 3}
>>> D
{'a': 1, 'c': 3, 'b': 2}
>>> 
>>> 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
{'a': 1, 'c': 3, 'b': 2}
>>> D.keys()
['a', 'c', 'b']
>>> D.values()
[1, 3, 2]
>>> D.items()
[('a', 1), ('c', 3), ('b', 2)]
>>> 
>>> 
>>> open('data.txt').read()
'Hello\nworld.\n'
>>> 
>>> open('data.txt').readlines()
['Hello\n', 'world.\n']
>>> 
>>> 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)
''
>>> for line in open('data.txt'):
	print line.upper(),

	
HELLO
WORLD.
>>> 
>>> import struct
>>> struct.unpack(
KeyboardInterrupt
>>> 
>>> import csv
>>> dir(csv)
['Dialect', 'DictReader', 'DictWriter', 'Error', 'QUOTE_ALL', 'QUOTE_MINIMAL', 'QUOTE_NONE', 'QUOTE_NONNUMERIC', 'Sniffer', 'StringIO', '_Dialect', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__version__', 'excel', 'excel_tab', 'field_size_limit', 'get_dialect', 'list_dialects', 're', 'reader', 'reduce', 'register_dialect', 'unregister_dialect', 'writer']
>>> json.load(
KeyboardInterrupt
>>> 
>>> import os
>>> os.open
>>>
>>> None
>>> L = []
>>> L[99]

Traceback (most recent call last):
  File "<pyshell#366>", line 1, in <module>
    L[99]
IndexError: list index out of range
>>> 
>>> L[99] = 1

Traceback (most recent call last):
  File "<pyshell#368>", 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]
>>>
>>> L = [0] * 100
>>> L
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
>>> 
>>> 
>>> S = {'a', 'b', 'a', 'c', 'd'}
>>> S
set(['a', 'c', 'b', 'd'])
>>> 
>>> S | {'a', 'b', 'x'}
set(['a', 'c', 'b', 'd', 'x'])
>>> 
>>> [1, 2, 3, 1, 2, 3, 1, 4, 2, 1, 5]
[1, 2, 3, 1, 2, 3, 1, 4, 2, 1, 5]
>>> 
>>> L = [1, 2, 3, 1, 2, 3, 1, 4, 2, 1, 5]
>>> 
>>> set(L)
set([1, 2, 3, 4, 5])
>>> 
>>> L
[1, 2, 3, 1, 2, 3, 1, 4, 2, 1, 5]
>>> list(set(L))
[1, 2, 3, 4, 5]
>>> 