Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

    ****************************************************************
    Personal firewall software may warn about the connection IDLE
    makes to its subprocess using this computer's internal loopback
    interface.  This connection is not visible on any external
    interface and no data is sent to or received from the Internet.
    ****************************************************************
    
IDLE 1.2      ==== No Subprocess ====
>>> 2 ** 10
1024
>>> 
>>> 'spam' + 'NI'
'spamNI'
>>> 
>>> import sys
>>> sys.platform
'win32'
>>> 
1606938044258990275541962092341162602522202993782792835301376
C:\Python25
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!

>>> 
1606938044258990275541962092341162602522202993782792835301376
C:\Python25
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!

>>> 
1606938044258990275541962092341162602522202993782792835301376
C:\Python25
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!
>>> 
>>> 
>>> import sgatenov1
1606938044258990275541962092341162602522202993782792835301376
C:\Python25
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!
>>> 
>>> import sgatenov1
>>> import sgatenov1
>>> import sgatenov1
>>> import sgatenov1
>>> 
>>> reload(sgatenov1)
1606938044258990275541962092341162602522202993782792835301376
C:\Python25
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!
<module 'sgatenov1' from 'C:\Python25\sgatenov1.py'>
>>> 
1606938044258990275541962092341162602522202993782792835301376
C:\Python25
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!
>>> 
1606938044258990275541962092341162602522202993782792835301376
C:\Python25
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!
>>> 
>>> S = 'spam'
>>> 
>>> len(S)
4
>>> S + 'NI'
'spamNI'
>>> 
>>> S * 8
'spamspamspamspamspamspamspamspam'
>>> 
>>> S
'spam'
>>> 
>>> S = S + 'NI'
>>> S
'spamNI'
>>> 
>>> S[0]
's'
>>> S[1]
'p'
>>> 
>>> S[-1]
'I'
>>> S[-2]
'N'
>>> 
>>> S[len(S)-1]
'I'
>>> S[-1]
'I'
>>> S
'spamNI'
>>> 
>>> 
>>> S[1:4]
'pam'
>>> 
>>> S[:4]
'spam'
>>> 
>>> S[1:]
'pamNI'
>>> 
>>> S
'spamNI'
>>> 
>>> S[:-1]
'spamN'
>>> 
>>> S[:]
'spamNI'
>>> 
>>> 
>>> S
'spamNI'
>>> S[0]
's'
>>> S[0] = 'X'
Traceback (most recent call last):
  File "<pyshell#55>", line 1, in <module>
    S[0] = 'X'
TypeError: 'str' object does not support item assignment
>>> 
>>> S
'spamNI'
>>> 
>>> S.find('am')
2
>>> 
>>> S
'spamNI'
>>> S.replace('am', 'XYZ')
'spXYZNI'
>>> 
>>> S
'spamNI'
>>> 
>>> line = 'aaa,bbbb,ccc'
>>> line.split(',')
['aaa', 'bbbb', 'ccc']
>>> 
>>> line = 'aaa,bbbb,ccc\n'
>>> 
>>> line[:-1]
'aaa,bbbb,ccc'
>>> 
>>> line
'aaa,bbbb,ccc\n'
>>> line.rstrip()
'aaa,bbbb,ccc'
>>> 
>>> dir(line)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', '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']
>>> 
>>> help(line.endswith)
Help on built-in function endswith:

endswith(...)
    S.endswith(suffix[, start[, end]]) -> bool
    
    Return True if S ends with the specified suffix, False otherwise.
    With optional start, test S beginning at that position.
    With optional end, stop comparing S at that position.
    suffix can also be a tuple of strings to try.

>>> import sys
>>> dir(sys)
['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__', '__stdin__', '__stdout__', '_current_frames', '_getframe', 'api_version', 'argv', 'builtin_module_names', 'byteorder', 'call_tracing', 'callstats', 'copyright', 'displayhook', 'dllhandle', 'exc_clear', 'exc_info', 'exc_type', 'excepthook', 'exec_prefix', 'executable', 'exit', 'exitfunc', 'getcheckinterval', 'getdefaultencoding', 'getfilesystemencoding', 'getrecursionlimit', 'getrefcount', 'getwindowsversion', 'hexversion', 'last_traceback', 'last_type', 'last_value', 'maxint', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'ps1', 'setcheckinterval', 'setprofile', 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', 'subversion', 'version', 'version_info', 'warnoptions', 'winver']
>>> 
>>> help(sys.getrefcount)
Help on built-in function getrefcount in module sys:

getrefcount(...)
    getrefcount(object) -> integer
    
    Return the reference count of object.  The count returned is generally
    one higher than you might expect, because it includes the (temporary)
    reference as an argument to getrefcount().

>>> L = [123, 'spam', 1.23]
>>> 
>>> len(L)
3
>>> 
>>> L + [4, 5, 6]
[123, 'spam', 1.23, 4, 5, 6]
>>> 
>>> L * 4
[123, 'spam', 1.23, 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.append("NI!")
>>> 
>>> L
[123, 'spam', 1.23, 'NI!']
>>> 
>>> del L[2]
>>> L
[123, 'spam', 'NI!']
>>> 
>>> L[1] = 99
>>> L
[123, 99, 'NI!']
>>> 
>>> 
>>> 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]
SyntaxError: invalid syntax
>>> 
>>> M[1][2]
6
>>> 
>>> col2 = [row[1] for row in M]
>>> col2
[2, 5, 8]
>>> 
>>> 
>>> D = {}
>>> D['name'] = 'Bob'
>>> D['job']  = 'dev'
>>> D['age']  = 40
>>> 
>>> D
{'age': 40, 'job': 'dev', 'name': 'Bob'}
>>> 
>>> print D['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'][-1]
'mgr'
>>> 
>>> rec['job'].append('janitor')
>>> 
>>> rec
{'age': 40.5, 'job': ['dev', 'mgr', 'janitor'], 'name': {'last': 'Smith', 'first': 'Bob'}}
>>> 
>>> rec = 0
>>> Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
    return self.func(*args)
  File "C:\Python25\lib\idlelib\MultiCall.py", line 151, in handler
    r = l[i](event)
  File "C:\Python25\lib\idlelib\PyShell.py", line 1134, in enter_callback
    self.newline_and_indent_event(event)
  File "C:\Python25\lib\idlelib\EditorWindow.py", line 1157, in newline_and_indent_event
    y.set_str(rawtext)
  File "C:\Python25\lib\idlelib\PyParse.py", line 119, in set_str
    assert len(str) == 0 or str[-1] == '\n'
AssertionError

>>> 
>>> 
>>> 
>>> Exception in Tkinter callback
SyntaxError: invalid syntax
>>> 
>>> 
>>> D = {'a':1, 'b':2, 'c':3}
>>> 
>>> D['d'] = 4
>>> D['e']
Traceback (most recent call last):
  File "<pyshell#158>", line 1, in <module>
    D['e']
KeyError: 'e'
>>> 
>>> D.has_key('e')
False
>>> 
>>> if not D.has_key('e'):
	print 'missing...'

	
missing...
>>> 
>>> D = {'a':1, 'b':2, 'c':3}
>>> 
>>> D
{'a': 1, 'c': 3, 'b': 2}
>>> 
>>> Ks = D.keys()
>>> D
{'a': 1, 'c': 3, 'b': 2}
>>> 
>>> 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}
>>> 
>>> for c in 'abcdefg':
	print c.upper()

	
A
B
C
D
E
F
G
>>> 
>>> T = (1, 2, 3, 4)
>>> 
>>> T[0]
1
>>> T[1:]
(2, 3, 4)
>>> T + (6, 7)
(1, 2, 3, 4, 6, 7)
>>> T * 8
(1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4)
>>> 
>>> T[0] = 99
Traceback (most recent call last):
  File "<pyshell#194>", line 1, in <module>
    T[0] = 99
TypeError: 'tuple' object does not support item assignment
>>> 
>>> 
>>> 
>>> 
>>> 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.

>>> import os
>>> os.getcwd()
'C:\\Python25'
>>> 
>>> import glob
>>> glob.glob('data*')
['data', 'data.bin', 'data.txt', 'datafile.txt']
>>> 
>>> 
>>> 
>>> S = '42'
SyntaxError: invalid syntax
>>> 
>>> S = '42'
>>> I = 1
>>> 
>>> S + I
Traceback (most recent call last):
  File "<pyshell#222>", line 1, in <module>
    S + I
TypeError: cannot concatenate 'str' and 'int' objects
>>> 
>>> 123 + 2.0
125.0
>>> 
>>> int(S)
42
>>> int(S) + I
43
>>> 
>>> str(I)
'1'
>>> 
>>> S + str(I)
'421'
>>> 
>>> 
>>> X = 99
>>> X = 'spam'
>>> X = 1.23
>>> 
>>> L = [1, 2, 3]
>>> M = L
>>> 
>>> L == M
True
>>> L is M
True
>>> 
>>> L = [1, 2, 3]
>>> M = [1, 2, 3]
>>> L == M
True
>>> L is M
False
>>> 
>>> 
>>> S = 'A\nB\tC'
>>> 
>>> ord('\n')
10
>>> len(S)
5
>>> S = 'A\0B\0C'
>>> 
>>> len(S)
5
>>> 
>>> msg = """
aaaaaaaaaaaaaaaaaaa
bbbbb''''bbbbbbb""bbb
ccccccccccccc"""
>>> msg
'\naaaaaaaaaaaaaaaaaaa\nbbbbb\'\'\'\'bbbbbbb""bbb\nccccccccccccc'
>>> 
>>> print msg

aaaaaaaaaaaaaaaaaaa
bbbbb''''bbbbbbb""bbb
ccccccccccccc
>>> 
>>> c ols = ['aaa', 'bb', 'cccc']
SyntaxError: invalid syntax
>>> 
>>> 
>>> cols = ['aaa', 'bb', 'cccc']
>>> 
>>> 'XYZ'.join(cols)
'aaaXYZbbXYZcccc'
>>> 
>>> 
>>> D
{'a': 1, 'c': 3, 'b': 2}
>>> 
>>> 
>>> D['e']
Traceback (most recent call last):
  File "<pyshell#277>", line 1, in <module>
    D['e']
KeyError: 'e'
>>> 
>>> D.get('e', 'missing')
'missing'
>>> 
>>> D.get('a', 'missing')
1
>>> 
>>> dir(0)
['__abs__', '__add__', '__and__', '__class__', '__cmp__', '__coerce__', '__delattr__', '__div__', '__divmod__', '__doc__', '__float__', '__floordiv__', '__getattribute__', '__getnewargs__', '__hash__', '__hex__', '__index__', '__init__', '__int__', '__invert__', '__long__', '__lshift__', '__mod__', '__mul__', '__neg__', '__new__', '__nonzero__', '__oct__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdiv__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__str__', '__sub__', '__truediv__', '__xor__']
>>> 
>>> dir(int)
['__abs__', '__add__', '__and__', '__class__', '__cmp__', '__coerce__', '__delattr__', '__div__', '__divmod__', '__doc__', '__float__', '__floordiv__', '__getattribute__', '__getnewargs__', '__hash__', '__hex__', '__index__', '__init__', '__int__', '__invert__', '__long__', '__lshift__', '__mod__', '__mul__', '__neg__', '__new__', '__nonzero__', '__oct__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdiv__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__str__', '__sub__', '__truediv__', '__xor__']
>>> 
>>> 
>>> import struct
>>> F = open('data.bin', 'wb')
>>> data = struct.pack('>i4sh', 7, 'spam', 8)
>>> data
'\x00\x00\x00\x07spam\x00\x08'
>>> F.write(data)
>>> F.close()
>>> 
>>> F = open('data.bin', 'rb')
>>> bytes = F.read()
>>> bytes
'\x00\x00\x00\x07spam\x00\x08'
>>> vals = struct.unpack('>i4sh', bytes)
>>> vals
(7, 'spam', 8)
>>> vals[0]
7
>>> vals[1]
'spam'
>>> 
>>> vals
(7, 'spam', 8)
>>> a, b, c = vals
>>> a
7
>>> b
'spam'
>>> c
8
>>> X = None
>>> 
>>> L = []
>>> L[99]
Traceback (most recent call last):
  File "<pyshell#311>", line 1, in <module>
    L[99]
IndexError: list index out of range
>>> 
>>> L[99] = 1
Traceback (most recent call last):
  File "<pyshell#313>", 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]
>>> 
>>> print X
None
>>> 
