First time here? Check out the FAQ!
answered 12 years ago
I use this to check whether one is running in the notebook or not
if sage.misc.latex.EMBEDDED_MODE: # If in the notebook # do something specific to notebook else: # do something that is possible in command line, # like carriage returns :)