How a script can know if it has been called with the -i command lineoption?

Hendrik van Rooyen mail at microcorp.co.za
Fri Dec 22 00:16:29 EST 2006


"Michele Simionato" <michele.simionato at gmail.com> wrote:


> The subject says it all, I would like a script to act differently when
> called as
> $ python script.py and when called as $ python -i script.py. I looked
> at the sys module
> but I don't see a way to retrieve the command line flags, where should
> I look?

sys.argv()   ?

- Hendrik




More information about the Python-list mailing list