Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> print "hello World"
- File "<stdin>", line 1
- print "hello World"
- ^
- SyntaxError: invalid syntax
- print("Hello World")
- print('Hello world!')
- print("Hello world")
- print("hello World")
- print("Hello World")
- from __future__ import print_function
- Old: print "The answer is", 2*2
- New: print("The answer is", 2*2)
- Old: print x, # Trailing comma suppresses newline
- New: print(x, end=" ") # Appends a space instead of a newline
- Old: print # Prints a newline
- New: print() # You must call the function!
- Old: print >>sys.stderr, "fatal error"
- New: print("fatal error", file=sys.stderr)
- Old: print (x, y) # prints repr((x, y))
- New: print((x, y)) # Not the same as print(x, y)!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement