Newbie: How to create a global or static variable?

e.e.sutton at cummins.com e.e.sutton at cummins.com
Mon Jan 31 10:52:26 EST 2000


I am trying to convert a simple Microsoft VBScript example script which
manipulates an Excel spreadsheet via COM (excel.vbs) to Python for an
apples-to-apples comparison of this particular script and how it looks
in each language. I know can I have classes in Pyhton but I do not want
to do that yet.

1 - How do I create a global variable in a script that is in scope for
all the functions defined in the script?

2 - Can I create a static variable with an initial assignment in a
function?

I have not yet found the documentation I need to explain the scope of
variables in Python. I am coming from a C/C++ background.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list