How to access the other scripts list values in current script in python -


i have script1.py

import sys lst = [] v in range(1,int(len(sys.argv)),1):    lst.append(sys.argv[v]) 

script2.py

from script1 import lst print lst 

if execute python script2.py abc xyz, gives output [] (an empty list).

how can achieve this, please me.

//--- import lst variable, because of from script import lst. so, code not execute, , have lst = []. make approach, list comprehension ok. //--- oh, terribly sorry, fault. it's wrong concept, script execute fully. so, problem lies in field.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -