14

Instead of:

$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

I'd like, for example:

$ python --quiet
>>>
1

2 Answers 2

16

You can try this:

$ python -ic ""
>>> 
1
  • 1
    This works by asking Python to interpret (-c) an empty string of code, and then drop into interactive mode (-i) after that. Commented Aug 16, 2022 at 2:57
6

Python 3 now has a -q flag:

python3 -q

For Python 2, I have a startup file, so this works for me:

python2 -i "$PYTHONSTARTUP"
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.