How to use "while" within the command in -c option of python?

Discussion in 'Python' started by Herman, Oct 12, 2012.

  1. Herman

    Herman Guest

    python -c "import os; while True: print('hello')"
    File "<string>", line 1
    import os; while True: print('hello')
    ^
    SyntaxError: invalid syntax
     
    Herman, Oct 12, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shawn Minisall

    while within while

    Shawn Minisall, Oct 27, 2007, in forum: Python
    Replies:
    11
    Views:
    522
  2. Etienne Robillard
    Replies:
    11
    Views:
    283
    Chris Angelico
    Oct 13, 2012
  3. Dave Angel
    Replies:
    0
    Views:
    186
    Dave Angel
    Oct 13, 2012
  4. Herman
    Replies:
    0
    Views:
    219
    Herman
    Oct 13, 2012
  5. Ned Deily
    Replies:
    0
    Views:
    177
    Ned Deily
    Oct 13, 2012
Loading...

Share This Page