how can I execute Python 3.3 script in Spyder console, and that has variables?
My sample code (C:/test/myfile.py) is
from sys import argv
script, first, second, third = argv
print("The script is called:", script)
print("Your first variable is:", first)
print("Your second variable is:", second)
print("Your third variable is:", third)
I have tried exec(open("C:estmyfile.py").read()) - and the error I get is "ValueError: need more than 1 value to unpack. I want to supply the variables first = "1st", second = "2nd", third = "3rd". How can I write the exec() so that it can handle the inputs?
I'm using Python 3.3, 64-bit installation, Windows OS, installation: WinPython.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…