Python Forum
mixing bytes with strings - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: mixing bytes with strings (/thread-18491.html)



mixing bytes with strings - Skaperen - May-20-2019

a found a case where i can use bytes with strings, though there could be more such cases. what i found by experimenting is that the str.translate() method accepts bytes for the table. the table just needs to be rather long to translate some Unicode characters. and, of course, it can only translate to a character with an ordinal from 0 to 255.


RE: mixing bytes with strings - heiner55 - May-22-2019

Do you think this is an error or a feature ?


RE: mixing bytes with strings - Skaperen - May-22-2019

an inconsistency.


RE: mixing bytes with strings - heiner55 - May-29-2019

Then you should write this inconsistency to Python.org.