How to pause and wait for command input in a python script
<p>Is it possible to have a script like the following in python?</p>

<pre><code>...
Pause
-&gt;
Wait for the user to execute some commands in the terminal (e.g. 
  to print the value of a variable, to import a library, or whatever).
The script will keep waiting if the user does not input anything.
-&gt;
Continue execution of the remaining part of the script
</code></pre>

<p>Essentially the script gives the control to the python command line interpreter temporarily, and resume after the user somehow finishes that part.</p>

<p>Edit:
What I come up with (inspired by the answer) is something like the following:</p>

<pre><code>x = 1

i_cmd = 1
while True:
  s = raw_input('Input [{0:d}] '.format(i_cmd))
  i_cmd += 1
  n = len(s)
  if n &gt; 0 and s.lower() == 'break'[0:n]:
    break
  exec(s)

print 'x = ', x
print 'I am out of the loop.'
</code></pre>
