Is there a way to loop in while
if you run the script with python -c
? This is not like the platform or python version ...
Linux
[ mpenning@Hotcoffee ~]$ python -c "import os;while (True): os.system('ls')" File "<string>", line 1 import os;while (True): os.system('ls') ^ SyntaxError: invalid syntax [ mpenning@Hotcoffee ~]$ [ mpenning@Hotcoffee ~]$ python -V Python 2.6.6 [ mpenning@Hotcoffee ~]$ uname -a Linux Hotcoffee 2.6.32-5-amd64
Window
C:\Users\mike_pennington>python -c "import os;while True: os.system('dir')" File "<string>", line 1 import os;while True: os.system('dir') ^ SyntaxError: invalid syntax C:\Users\mike_pennington>python -V Python 2.7.2 C:\Users\mike_pennington>
I tried to remove the brackets in the while
statement, but does nothing to make this run.
source share