Debian Codegraph @

docs/user/handling_result.rst

raw
1 ================
2 Handling Result
3 ================
4
5 When initiating search upon a buffer, bytes or file you can assign the return value and fully exploit it.
6
7 ::
8
9 my_byte_str = 'Bсеки човек има право на образование.'.encode('cp1251')
10
11 # Assign return value so we can fully exploit result
12 result = from_bytes(
13 my_byte_str
14 ).best()
15
16 print(result.encoding) # cp1251
17
18 Using CharsetMatch
19 ----------------------------
20
21 Here, ``result`` is a ``CharsetMatch`` object or ``None``.
22
23 .. autoclass:: charset_normalizer.CharsetMatch
24 :members:
25