% python
>>> print 'Hello world!'
Hello world!
>>> print 2 ** 8
256



>>> lumberjack = 'okay'   
>>> lumberjack
'okay'
>>> 2 ** 8
256
>>>                      use Ctrl-D or Ctrl-Z to exit
%



# spam.py
print 2 ** 8                              # Raise to a power.
print 'the bright side ' + 'of life'      # + means concatenation.



#!/usr/local/bin/python
print 'The Bright Side of Life...'         # filename: brian



# script4.py
# A comment
import sys
print sys.platform
print 2 ** 100



# script4.py, revised
# A comment
import sys
print sys.platform
print 2 ** 100
raw_input()             # ADDED



>>> import script4
win32
1267650600228229401496703205376
>>> import script4
>>> import script4
>>> reload(script4)
win32
65536
<module 'script4' from 'script4.py'>



# myfile.py
title = "The Meaning of Life"



% python                        # Start Python.
>>> import myfile               # Run file; load module as a whole.
>>> print myfile.title          # Use its attribute names: `.' to qualify.
The Meaning of Life

% python                        # Start Python.
>>> from myfile import title    # Run file; copy its names.
>>> print title                 # Use name directly: no need to qualify.
The Meaning of Life



# threenames.py 
a = 'dead'          # Define three attributes.
b = 'parrot'        # Exported to other files
c = 'sketch'
print a, b, c       # Also used in this file



% python
>>> import threenames                  # Grab the whole module.
dead parrot sketch
>>>
>>> threenames.b, threenames.c
('parrot', 'sketch')
>>>
>>> from threenames import a, b, c     # Copy multiple names.
>>> b, c
('parrot', 'sketch')

>>> dir(threenames)
['__builtins__', '__doc__', '__file__', '__name__', 'a', 'b', 'c']

