Using a conditional in the python interpreter -c command

Viewed 1689

I am trying to figure out how to pass the following conditional statement into the python interpreter's command option (-c).

if sys.maxsize > 2**32:
    print '64'
else:
    print '32'

64

However, I continually get syntax errors, such as the following:

>python -c "import sys; if sys.maxsize > 2**32: print '64' else: print '32';"
  File "<string>", line 1
    import sys; if sys.maxsize > 2**32: print '64' else: print '32';
                 ^
SyntaxError: invalid syntax

I found it surprisingly difficult to find a good example of this usage. I must be missing something big here...

3 Answers
Related