python: ignoring leading “>>>” and “…” in interactive mode?
Many online python examples show interactive python sessions with normal leading ">>>" and "..." characters before each line. Often, there's no way to copy this code without also getting these prefixes. In these cases, if I want to re-paste this code into my own python interpreter after copying, I have to do some work to first strip off those prefixes. Does anyone know of a way to get python or iPython (or any other python interpreter) to automatically ignore leading ">>>" and "..." characters on lines that are pasted in? Example: >>> if True: ... print("x") ... You just need to either switch