I have a scenario, where I have to call a certain Python script multiple times in another python script.
script1:
import sys
path=sys.argv
print "I am a test"
print "see! I do nothing productive."
print "path:",path[1]
script2:
import subprocess
l=list()
l.append('root')
l.append('root1')
l.append('root2')
for i in l:
cmd="python script1.py i"
subprocess.Popen(cmd,shell=True)
Here, my issue is that in script 2, I am not able to replace the value of "i" in the for loop. Can you help with that?
cmd = "python script1.py " + str(i). You are hardcodingias a character, and not using its value.