4 ms·
I've worked with Unicode and ASCII conversion directly before in Python, and even then I didn't need these two. There is `str.translate` which requires ordinals
by diarrhea 5y ago
I've worked with Unicode and ASCII conversion directly before in Python, and even then I didn't need these two. There is `str.translate` which requires ordinals aka Unicode codepoints integers, which you would use `ord(str)` for. But then there's also `str.maketrans` which does this 'low-level' fiddling for you: https://docs.python.org/3/library/stdtypes.html#str.maketrans https://docs.python.org/3/library/stdtypes.html#str.maketran... . So even then, arguably a prime use case for `ord` and `chr`, I was able to forego them and work a 'level higher'.