python -c 'import time; while True: time.sleep(5)' fails with syntax error

Viewed 116

In my bash Terminal (Mac OS) I type the following:

python -c 'import time; while True: time.sleep(5)'

And a SyntaxError is thrown.

Why should this be? Both of the following examples run:

python -c 'import time; time.sleep(5)'
python -c 'while True: pass'

so not sure why this is throwing an error.

0 Answers
Related