calling a variable from a separate function

Emile van Sebille emile at fenx.com
Sun Jul 8 22:43:31 EDT 2001


Well, I'm going to guess you mean to be working in a class.  Then what you'd
say is:

class Test:        #--untested--
    def func1(self):
        self.var1 = 22
    def func2(self):
        print self.var1

HTH,

--

Emile van Sebille
emile at fenx.com

---------
"eric_brake" <brakedon at hotmail.com> wrote in message
news:7b515e0f.0107081752.5dc1680d at posting.google.com...
> Let's say
>
> def function1:
>      self.variable1 = 22
> def function2:
>      print variable1
>
> Would function2 look like "print function1.variable1" or some other
> way? By the way I already know that the "function1.variable1" format
> doesn't work. thanks for any help.




More information about the Python-list mailing list