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
Vince Buffalo edited this page Aug 10, 2015
·
1 revision
Executing something only if Python's in interactive mode
import __main__ as main
if not hasattr(main, '__file__'):
# stuff goes here
This is useful if one has a script that outputs something to standard out that they'd like to work interactively with — just throw the outputting code in this block.