Can I check if I'm running from the interpreter prompt?

skip at pobox.com skip at pobox.com
Fri Nov 14 18:48:31 EST 2008


    Peter> hasattr(sys, "ps1")

Thanks.  I wasn't aware there was a documented way to check for
interactivity.  It would have been more obvious if sys had an
"isinteractive" method or attribute.

-- 
Skip Montanaro - skip at pobox.com - http://smontanaro.dyndns.org/



More information about the Python-list mailing list