Possible Duplicate:
How to print in Python without newline or space?
How to print a string without including ‘\n’ in Python
I have a code that looks like this:
print 'Going to %s'%href
try:
self.opener.open(self.url+href)
print 'OK'
When I execute it I get two lines obviously:
Going to mysite.php
OK
But want is :
Going to mysite.php OK
for your example:
the comma at the end of the print statement instructs to not add a
'\n'newline character.I assumed this question was for python 2.x because
printis used as a statement. For python 3 you need to specifyend=''to the print function call: