[Tutor] arrays and strings
Erik Price
erikprice@mac.com
Wed, 8 May 2002 07:55:08 -0400
On Wednesday, May 8, 2002, at 08:46 AM, wonderer@pakistanmail.com wrote:
> I m sorry to bother u again but i just wanted to know if there is any
> equivalent
> of c-style #define in python
> coz i m decalring a varianle globally in one file (util.py)and then
> want to
> access in another file named test.py but that gives me error as
> NameError:"name"
> not defined
wonderer, fyi I CC'd this msg to the list b/c I'm no Python master, and
hopefully someone else can come up with something constructive.
From what I understand of Python, you would want to import "util.py" as
a module into the script where you're trying to use the global variable,
which means that the global variable is now "util.variablename" (I
think). I have no experience with C, so I'm not sure if this is the
same thing as #define (not sure what that is...)
Good luck though.
Erik