<p>如果我有以下程序:</p>
<pre><code> def P(x):
# x is an integer
print str(x)
</code></pre>
<p>我想要一个输出,比如:</p>
<pre><code> >>> You chose the number: X
</code></pre>
<p>其中X是程序p中打印的结果。
我怎么能在不改变程序的情况下做到这一点?你知道吗</p>
<p>如果我这样做:</p>
<pre><code> print 'You chose the number: '
P(x)
</code></pre>
<p>我去拿</p>
<pre><code> You chose the number:
X
</code></pre>
<p>我怎样才能让他们站在同一条线上?你知道吗</p>