Modules for Python

Steve Holden sholden at
Thu Oct 25 13:20:06 CEST 2001

"Lukasz Pawelczyk" <pawelczyk at> wrote in ...
> Hello,
> Could anyone tell me where I can find the modules for Python?
> Especially, I am looking for any module to read MS Excel files
> in Python.
What you need, if you are using the Windows platform, is Mark Hammond's
"win32all" extensions. You can find them on ActiveState's web site
( I usually find the most convenient way to get them is
to install their ActivePython distribution - just don't try to re-distribute
it, their license is a little different.

Here's an example that runs under the Windows scripting host:

#app._print_details_() # Use this to see what Python knows about a COM

g_index = 1
# A procedure, using a global.
def Show(desc, value = None):
 global g_index # Need global for g_index, as I locally assign.
 # No global needed to "xl" object, as only referenced.
 # Also note "xl" is assigned later in the script - ie, Python is very late
 xl.Cells(g_index, 1).Value = desc
 if value: xl.Cells(g_index, 2).Value = value
 g_index = g_index + 1

xl = WScript.CreateObject("Excel.Application")
import sys

xl.Visible = 1
#xl.Workbooks().Add() # Excel versions before 98

# Show the WScript properties.
Show("Application Friendly Name", WScript.Name)
Show("Application Version", WScript.Version)
Show("Application Context: Fully Qualified Name", WScript.FullName)
Show("Application Context: Path Only", WScript.Path)
Show("State of Interactive Mode", WScript.Interactive)

Show("All script arguments:")
args = WScript.Arguments

for i in xrange(0,args.Count()):
 Show("Arg %d" % i, args(i))


More information about the Python-list mailing list