Introduction to New In Python 3.0
What’s New In Python 3.0
A lot of changes in python 3.0 I have introduce some impotent future of python 3.0.
- Print Is A Function
The print statement has been replaced with a print() function, with keyword arguments to replace most of the special syntax of the old print statement
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)!
You can also customize the separator between items, e.g.:
print("There are <", 2**32, "> possibilities!", sep="")
3. Ordering Comparisons
4. Integers
5. Text Vs. Data Instead Of Unicode Vs. 8-bit
5. Text Vs. Data Instead Of Unicode Vs. 8-bit
0 comments:
Post a Comment