I've provided an example below that will reveal one console line at a time. This is probably the best that can be done, at least without a lot of work. Getting this to work required patching beamer in the preamble.
Automatically inserting a
\pause after each console command, before its output, would be complicated. You would have to create a wrapper for Python's
code module (which is what PythonTeX uses internally) that would highlight each command and output separately, inserting
\pause at appropriate points. And then you would have to connect this custom module into PythonTeX.
However, if simply displaying one line of a console session at a time is sufficient (which is what your example did) the following will work. This relies on redefining
fancyvrb, so that a
\pause is inserted at the end of each line of console content.
Just doing that alone gives you the result you want, but you would have to run PythonTeX and then recompile the document for each line of console content, which is obviously unacceptable. This is due to the way that beamer deals with verbatim content; it keeps re-reading verbatim content for each overlay, and each re-read makes PythonTeX think that there is more code to execute. Fixing this requires resetting the PythonTeX counter that governs console code before each re-read. Doing that requires hacking the beamer internals. I've patched the beamer internals in the example below, so that PythonTeX only needs to be run a single time.
% Need to go ahead and create a counter for each console session
% Proceed assuming only the default
% Need temp counter for resetting console counter, since the counter
% is incremented each time beamer re-reads verbatim content
% Need a custom version of beamer's verbatim input routine
% The original is from beamerbaseframe.sty
% Reset counter
What is the result in Python 2 of:
7 / 2
What will be the last output?
L = [5, 3, 42, 1]