class T():
    def aa(self):
        write = 1
        print '123'

class B():
            def hehe(self):
                print write

c = B()
        c.hehe()

a = T()
a.aa()

输出:

123

1

05-27 03:36