2
I have this code:
donos=[]
def calcula_media():
lista_dicionario= [1,2,3]
donos.extend(lista_dicionario)
def funcao2():
print donos
How can I use the global variable in the 2nd function using what I used in the 1st to do the extend
, that is to obtain [1,2,3] in the 2nd function?
Is there a problem? The best answer I can give you is not to do this. Avoid global.
– Maniero
Yes, I have a function ( a 1º ) that allows to obtain a list of dictionary, that I have already obtained and the 2nd that transforms this list of dictionary obtained in a CSV file , that I also know how to do , I just do not know how to get the list of the 1st function for the 2nd
– Força Chape
I don’t see any problem, you’re doing what you say you want.
– Maniero
No , in the 2nd function owners is an empty variable do not know why
– Força Chape
http://ideone.com/z5rSkv
– Maniero
what lines 9 and 10 do ?
– Força Chape
Call the functions, no calling, no executing
– Maniero
That’s right already gave , thanks :)
– Força Chape