Created
April 1, 2021 22:28
-
-
Save x/0155bb6bc0dcdaafccdf259b9c2805c1 to your computer and use it in GitHub Desktop.
Decode anything probably
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: import chardet | |
In [2]: s = b'200 \xb5l Ultra Po' | |
In [3]: chardet.detect(s) | |
Out[3]: {'encoding': 'ISO-8859-1', 'confidence': 0.73, 'language': ''} | |
In [4]: s.decode(chardet.detect(s)['encoding']) | |
Out[4]: '200 µl Ultra Po' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment