擅长:python、mysql、java
<p>在Python 3中,可以通过提供<code>end=""</code>到<code>print()</code>来抑制自动换行:</p>
<pre><code>print("Random string value", end="")
if a==0:
print(" is random")
else:
print()
</code></pre>
<p>见<a href="https://stackoverflow.com/questions/493386/how-to-print-in-python-without-newline-or-space">How to print without newline or space?</a></p>