View Single Post
Old 01-12-2020, 02:31 PM   #1357
bidou.bidou
Junior Member
bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!bidou.bidou , Klaatu Barada Niktu!
 
Posts: 3
Karma: 5176
Join Date: Jan 2020
Device: kobo
Quote:
Originally Posted by Rev. Bob View Post
And I, for one, am not fluent in Python 3. I can get by enough to make monkey-see, monkey-do tweaks and fixes, as I have in the past, but that kind of wholesale upgrade is beyond me.
Most of changes are really easy

_ Correcting mix between space and tabs in source code (should be done even for python 2.6)

_ iteritems() -> items()
_ iterkeys() -> keys()


_ from urlparse import urldefrag, urlparse, urlunparse
-> from urllib.parse import urldefrag, urlparse, urlunparse

_ from urllib import unquote as urlunquote
-> from urllib.parse import unquote as urlunquote

_ unicode -> str (all strings are utf8 now)



The only tricky part is bytes vs str (and file opened or not with b). Sometimes this is utf8 strings sometimes binary data. You just have to add a .decode("utf-8")/ .encode("utf-8") and open files with b option when you are reading/writing binary data. But you need to know what data is expected.
bidou.bidou is offline   Reply With Quote