1.print and print ()
2.yield
The following error occurred
Traceback (most recent):
File "<pyshell#32>", line 1, in <module>
F.next ()
Attributeerror: ' Generator ' object has no attribute ' next '
The reason is that in Python 3.x, the generator (the function with the yield keyword is recognized as the generator function), Next becomes __next__, and next is the method in previous versions of Python 3.x
3.unicode
In python3.x, there is no predefined Unicode type, and the built-in string is STR, but the characters in STR are UNICODE encoded
4.CMP ()
There's no such function in python3.x, that's what the official document says.
The CMP () function should be treated as gone, and the __cmp__ () special method is no longer supported. Use __lt__ () for sorting, __eq__ () with __hash__ (), and other rich comparisons as needed. (If you really need the CMP () functionality, you could use the expression (a > B) – (a < b) as the equivalent for CM P (A, b).)
The main idea is that the CMP () function has "left", if you really need the CMP () function, you can use the expression (a > B)-(a < b) instead of CMP (a, a)
Python 2.x and 3.x different points