Wie führe ich ein Python 3.3-Skript in der Spyder-Konsole mit Variablen aus?

Wie kann ich Python 3.3-Skript in der Spyder-Konsole ausführen und das hat Variablen?

Mein Beispielcode (C: /test/myfile.py) ist

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)

Ich habe versucht, exec (open ("C: \ test \ myfile.py"). Read ()) - und die Fehlermeldung lautet "ValueError: brauche mehr als 1 Wert zum Entpacken. Ich möchte zuerst die Variablen angeben =" 1st ", second =" 2nd ", third =" 3rd ". Wie kann ich exec () schreiben, damit es die Eingaben verarbeiten kann?

Ich verwende Python 3.3, 64-Bit-Installation, Windows-Betriebssystem, Installation: WinPython.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage