4 ms·
Why doesn't the 2to3 tool that ships with python work for them? I rarely write python but I've had to convert from python 2 to 3 several times and it has always
by isaac21259 6y ago
Why doesn't the 2to3 tool that ships with python work for them? I rarely write python but I've had to convert from python 2 to 3 several times and it has always work fine. Are there gaps in 2to3 which I haven't encountered that can't be fixed?
- eesmith 6y agoIf there's a mix of byte and unicode strings then 2to3 won't work. Consider: with open("a", "rb") as f: with open("b", "w") as g: g.write(">" + f.read(1)) There are also conversions in Python 2 between byte and string which aren't supported in Python 3: s = "123".encode("hex") t = "abcd".decode("hex")