python 2.7 - Import a list from a different file -


is there way can import list different python file? example if have list:

list1 = ['horses', 'sheep', 'cows', 'chickens', 'dog']

can import list other files? know import other functions do

from filename import defname

this user defined list , don't want have user input same list million times.

just few maybes how done:

from filename import listname or put lists function , import definition name

thanks

one option dump list temp file, , read other python script.

another option (if 1 python script calls other), pass list argument (e.g. using sys.argv[1] , *args, etc).


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -