if i do this , it will be ok :
def a():
b = [1,2,3]
def d():
print b
d()
a()
but i have many method need function d , so i have to defined it out of the function a , but it show error :
def d():
print b
def a():
b = [1,2,3]
d()
a()
error:
File "c.py", line 21, in <module>
a()
File "c.py", line 19, in a
d()
File "c.py", line 16, in d
print b
NameError: global name 'b' is not defined
so i have many different Variable, like b in different functions , so i don't want to send Variable like this :
def d(b1,b2,b3,b4,b5):
print b1,b2,b3,b4,b5
that is not very simple , so i do it like this :
d = \
'''
def d():\n
print b
'''
def a():
b = [1,2,3]
c = eval(d)
c()
a()
but it also show error:
File "c.py", line 16, in <module>
a()
File "c.py", line 13, in a
c = eval(d)
File "<string>", line 2
def d():
^
so what can i do ,
thanks