Getting rid of extra spaces in print

Laurent Martin laurent at
Sun May 28 02:53:46 EDT 2000


I've just started learning Python. I try to write a simple script that
reads a file one character at a time and then prints it.  Thus I wrote: 

f = open('toto.src','r')

car =
while len(car):
    print car,

Unfortunately the 'print' function adds an extra space between my 
characters.  I've found a solution on to set
sys.stdout.softspace to 0 before each call to print.  This works but is
there a simpler and more elegant solution to this problem?


More information about the Python-list mailing list