+ 3

Python3 changes

Python gurus: I’m trying out python code from what seem to be python 2 examples. Is there a quick way to check what’s changed between versions and how to quickly adapt python2 code to work with python3? I’m trying urllib for scraping web page data but I’m finding that it doesn’t have the functions that the sample code is using.

3rd Jun 2018, 12:16 AM
Umair Salam
Umair Salam - avatar
3 Answers
3rd Jun 2018, 4:37 AM
Pedro Demingos
Pedro Demingos - avatar
+ 3
Thank you Pedro :) I'm finding that aside from the Python3 & older version differences, there are newer versions of popular libraries that you have to update the code for as well :) Gives me the same feeling as when I used to do Java development and constantly have to read documentation for new updates when older code got deprecated...fun times :)
3rd Jun 2018, 11:54 AM
Umair Salam
Umair Salam - avatar
Don't worry Umair Salam. Although updates can be painful, they are for the best. Indeed, Python 3 has incredibly powerful features that Python 2 simply does not have. So the effort is worthwhile. Even performing smaller updates, like from Python 3.7 to Python 3.8, is not so fun in the beginning, but after trying out all the new stuff, one does not regret it. I am quite thankful that Python has been getting better and better, and that great developers are working for it to be even more awesome, which always seems impossible :) But they always surprise me. Happy coding!
29th Nov 2019, 11:18 PM
Gonçalo Magalhaes
Gonçalo Magalhaes - avatar