Usual print statement in python will write to screen on a different line each time it is called.
eg : >>> print "hello"
print "world"
This will print the following on screen :
hello
world
Now to print on the same line we can use the below
sys.stdout.write("hello" + " ")
sys.stdout.write("world")
This will print the following on screen :
hello world
Comments
Post a Comment