print() in Python 3.0
In python 2.6 or below, “print” is just a simple statement to print output:
- print "Hello World!"
- print var1, var2
Now the print statement is replaced by the print() function in Python 3.0:
- print("Hello World!")
- print(var1, var2)
To suppress the trailing new line:
- print("Hello World!", end=" ")
- print("Hello World again!")
The above code will print: Hello World! Hello World again!
Reference: What’s New in Python 3.0
No Comments »
RSS feed for comments on this post. TrackBack URL
Leave a comment
You must be logged in to post a comment.