You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IDLE can be invoked from the command line with various options. The general syntax is:
666
666
667
-
-c command run command in the shell window
668
-
-d enable debugger and open shell window
669
-
-e open editor window
670
-
-h print help message with legal combinations and exit
671
-
-i open shell window
672
-
-r file run file in shell window
673
-
-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window
674
-
-t title set title of shell window
675
-
- run stdin in shell (- must be last option before args)
667
+
.. code-block:: bash
676
668
677
-
If there are arguments:
669
+
idle [options] [file ...]
678
670
679
-
* If ``-``, ``-c``, or ``r`` is used, all arguments are placed in
680
-
``sys.argv[1:...]`` and ``sys.argv[0]`` is set to ``''``, ``'-c'``,
681
-
or ``'-r'``. No editor window is opened, even if that is the default
682
-
set in the Options dialog.
671
+
The following options are available:
672
+
673
+
.. option:: -c <command>
674
+
675
+
Run the specified Python command in the shell window. For example:
676
+
677
+
.. code-block:: bash
678
+
679
+
idle -c "print('Hello, World!')"
680
+
681
+
.. option:: -d
682
+
683
+
Enable the debugger and open the shell window.
684
+
685
+
.. option:: -e
686
+
687
+
Open an editor window.
688
+
689
+
.. option:: -h
690
+
691
+
Print a help message with legal combinations of options and exit.
692
+
693
+
.. option:: -i
694
+
695
+
Open a shell window.
696
+
697
+
.. option:: -r <file>
698
+
699
+
Run the specified file in the shell window.
700
+
701
+
.. option:: -s
702
+
703
+
Run the startup file (as defined by the environment variables :envvar:`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`) before opening the shell window.
704
+
705
+
.. option:: -t <title>
706
+
707
+
Set the title of the shell window.
708
+
709
+
.. option:: -
710
+
711
+
Read and execute standard input in the shell window. This option must be the last one before any arguments.
712
+
713
+
If arguments are provided:
714
+
715
+
- If ``-``, ``-c``, or ``-r`` is used, all arguments are placed in ``sys.argv[1:]``, and ``sys.argv[0]`` is set to ``''``, ``'-c'``, or ``'-r'``. No editor window is opened, even if that is the default set in the Options dialog.
716
+
- Otherwise, arguments are treated as files to be opened for editing, and ``sys.argv`` reflects the arguments passed to IDLE itself.
683
717
684
-
* Otherwise, arguments are files opened for editing and
685
-
``sys.argv`` reflects the arguments passed to IDLE itself.
0 commit comments