Importing an output from another function

bearophileHUGS at bearophileHUGS at
Fri Mar 17 21:23:39 CET 2006

Generally, a name defined into a function can't be read outside of it,
so you have to return the function result explicitely:

import random

def Func1():
    choice = ('A', 'B', 'C')
    output = random.choice(choice)
    return output

def Func2(item):
    print item

output1 = Func1()


More information about the Python-list mailing list