command-line arguments in IDLE

Tal Einat at
Wed Nov 7 23:32:26 CET 2007

Russ P. wrote:
> Is it possible to pass command-line arguments when running a program
> in IDLE? The "Run" menu does not seem to provide that option. Thanks.

thunderfoot's workaround should work well, but requires changing the

If you want IDLE environment, but don't mind running IDLE from the
command line, you can do the following: -r this is a test

The script will run inside IDLE's shell with sys.argv set as you would
expect. The output will go to IDLE's shell, and once the script is
done running the shell will become interactive.

( is usually found in your Python installation under Lib/

- Tal Einat
reduce(lambda m,x:[m[i]+s[-1] for i,s in enumerate(sorted(m))],
      [[chr(154-ord(c)) for c in '.&-&,l.Z95193+179-']]*18)[3]

More information about the Python-list mailing list