How to get rid of the space after 'print',?

Charles Cazabon c_cazabon at hotmail.com
Fri Feb 11 01:16:11 CET 2000


Peter Bittner claimed in <38A34DFE.7B286DD at aston.ac.uk>:

>  print '<table border=0><tr>'
>  print '<td><b>Author:</b></td><td>',   # ,= no newline here
>  print '<input ...>'         # or put a function call here...
>
>Between <td> and <input> I want _no_ space, but Python automatically
>inserts one. - How can I force Python not to do this??

Try:

print '<table border=0><tr>'
print	'<td><b>Author:</b></td><td>' \
    	'<input ...>'

By using line continuation (\), python will automatically treat the two 
strings as one, just like an ANSI C compiler will.

Of course, it begs the question, why not just use:
print '<table border=0><tr>\n<td><b>Author:</b></td><td><input ...>'

Charles




More information about the Python-list mailing list