Python2 vs Python3: 36 Key Differences

Difference between Python2 and Python3? Here is the few differences between Python2 and Python3 1.    Print Statement vs Print Function 2.    Integer Division Behavior 3.    Unicode String Support 4.    xrange() vs range() 5.    Error Handling Syntax 6.    Input Function Behavior 7.    Iterators and Generators in dict Methods 8.    Library and Package Compatibility 9.    Function Annotations Support 10. The next() Function Usage 11. Standard Library Reorganization 12. Performance Improvements 13. String Formatting Methods 14. New Syntax for Integer Literals 15. Exceptions Syntax Change 16. Async and Await Support 17. Function Arguments with Default Values 18. Unicode and str Separation 19. Type Annotations for Variables 20. Simplified super() Function 21. Handling of Empty Dicts and Sets 22. Removal of cmp() Function 23. Removal of long Type 24. time Module Changes 25. os Module Modifications 26. socket Module Enhancements 27. Improved finally Block Behavior 28. Updated Metaclass Syntax 29. Removal of basestring Class 30. input() vs raw_input() Difference 31. Revised next() Function Implementation 32. range() Return Type Change 33. Improved callable() Function Behavior 34. Renamed Standard Library Modules 35. Enhanced String Formatting (format, f-strings) 36. Improved Integer Literal Syntax

To view or add a comment, sign in

Explore content categories