Python: Sending a variable to another script

37

$ cat first.py second.py 
#first.py
def demo():
    some_list = []
    for i in 'string':
         some_list.append( i )
    return some_list

#second.py 
from first import demo

some_list = demo()
print some_list 

$python second.py
['s', 't', 'r', 'i', 'n', 'g']

Comments

Submit
0 Comments