Python -- How do you view output that doesn't fit the screen?
<p>I should say I'm looking for a solution to the problem of <strong>viewing output that does not fit on your screen.</strong> For example, range(100) will show the last 30ish lines in your terminal of 30 height. </p>

<p>I am only looking to be nudged in the right direction and am curious how you guys have approached this problem. </p>

<p>What have you done when you run into a situation where you wish you could conveniently scroll through some large output? </p>

<h2>Best Answer</h2>

<p>Use the scrollback buffer on your terminal. </p>

<p>If you're using GNU Screen, it can be set with <code>defscrollback 1000</code> or any other number in <code>HOME/.screenrc</code>. </p>

<p>Use <code>Ctrl-a, [</code> to enter copy mode</p>

<pre><code>j -    Move the cursor down by one line
k -    Move the cursor up by one line
C-u -  Scrolls a half page up.
C-b -  Scrolls a full page up.
C-d -  Scrolls a half page down.
C-f -  Scrolls the full page down.
G -    Moves to the specified line 
</code></pre>

<p>The best part is <code>?</code> for reverse search, <code>/</code> for forward search while in copy mode. </p>

<p>Super convenient.</p>

<p>Thank you!</p>

<hr>

<h2>Original question:</h2>

<p>What is the python equivalent of the bash less command? </p>

<pre><code>LongString | less 
</code></pre>

<p>Is there something like that for python? I find myself thinking I could use it fairly often but just move on and find some other solution. </p>

<p>By "long things" I mean anything that generates more output lines than my screen. 1000 print messages, a dictionary, a large string, range(1000), etc. </p>

<p>My googlefu has failed.</p>
