Syntaxfehler bei Python-Einzeiler
python -c 'import sys; print "a"'
funktioniert und
python -c 'for a in [1, 2, 3]: print a'
funktioniert, aber
python -c 'import sys; for a in [1, 2, 3]: print a'
scheitert mit
File "<string>", line 1
import sys; for a in [1, 2, 3]: print a
^
Warum?
BEARBEITEN Mein Workaround:
python -c 'import sys; print "\n".join([1, 2, 3])'
(Zum Glück hat es auch für meinen echten Code funktioniert.)