可能重复:
How to print in Python without newline or space?
How to print a string without including ‘\n’ in Python如何在以前的字符串的Python结束打印字符串
我有一个看起来像这样的代码:
print 'Going to %s'%href
try:
self.opener.open(self.url+href)
print 'OK'
当我执行它时,我明显得到两行:
Going to mysite.php
OK
但要的是:
在你的第一个print
年底
Going to mysite.php OK
Got you!非常感谢 – Vor
似乎不适用于python 3:http://pastie.org/5054695 –
我从这个问题假设这不是python 3.让我包含它。 – dnozay