Py3: Terminal or browser output?

Gnarlodious gnarlodious at
Sat Feb 13 20:46:26 CET 2010

Hello, searched all over but no success. I want to have a script
output HTML if run in a browser and plain text if run in a Terminal.
In Python 2, I just said this:

if len(sys.argv)==True:

and it seemed to work. Py3 must have broken that by sending a list
with the path to the script in BOTH the browser and Terminal. Is there
some newfangled way to determine what is running the script (hopefully
without a try wrapper)?

-- Gnarlie

More information about the Python-list mailing list