.. module:: stringprep :synopsis: String preparation, as per RFC 3453
.. moduleauthor:: Martin v. Löwis <martin@v.loewis.de>
.. sectionauthor:: Martin v. Löwis <martin@v.loewis.de>
Source code: :source:`Lib/stringprep.py`
When identifying things (such as host names) in the internet, it is often necessary to compare such identifications for "equality". Exactly how this comparison is executed may depend on the application domain, e.g. whether it should be case-insensitive or not. It may be also necessary to restrict the possible identifications, to allow only identifications consisting of "printable" characters.
The module :mod:`stringprep` only exposes the tables from :mod:`stringprep` provides the "characteristic function", i.e. a function that
returns True if the parameter is part of the set. For mappings, it provides the
mapping function: given the key, it returns the associated value. Below is a
list of all functions available in the module.
.. function:: in_table_a1(code) Determine whether *code* is in tableA.1 (Unassigned code points in Unicode 3.2).
.. function:: in_table_b1(code) Determine whether *code* is in tableB.1 (Commonly mapped to nothing).
.. function:: map_table_b2(code) Return the mapped value for *code* according to tableB.2 (Mapping for case-folding used with NFKC).
.. function:: map_table_b3(code) Return the mapped value for *code* according to tableB.3 (Mapping for case-folding used with no normalization).
.. function:: in_table_c11(code) Determine whether *code* is in tableC.1.1 (ASCII space characters).
.. function:: in_table_c12(code) Determine whether *code* is in tableC.1.2 (Non-ASCII space characters).
.. function:: in_table_c11_c12(code) Determine whether *code* is in tableC.1 (Space characters, union of C.1.1 and C.1.2).
.. function:: in_table_c21(code) Determine whether *code* is in tableC.2.1 (ASCII control characters).
.. function:: in_table_c22(code) Determine whether *code* is in tableC.2.2 (Non-ASCII control characters).
.. function:: in_table_c21_c22(code) Determine whether *code* is in tableC.2 (Control characters, union of C.2.1 and C.2.2).
.. function:: in_table_c3(code) Determine whether *code* is in tableC.3 (Private use).
.. function:: in_table_c4(code) Determine whether *code* is in tableC.4 (Non-character code points).
.. function:: in_table_c5(code) Determine whether *code* is in tableC.5 (Surrogate codes).
.. function:: in_table_c6(code) Determine whether *code* is in tableC.6 (Inappropriate for plain text).
.. function:: in_table_c7(code) Determine whether *code* is in tableC.7 (Inappropriate for canonical representation).
.. function:: in_table_c8(code) Determine whether *code* is in tableC.8 (Change display properties or are deprecated).
.. function:: in_table_c9(code) Determine whether *code* is in tableC.9 (Tagging characters).
.. function:: in_table_d1(code) Determine whether *code* is in tableD.1 (Characters with bidirectional property "R" or "AL").
.. function:: in_table_d2(code) Determine whether *code* is in tableD.2 (Characters with bidirectional property "L").
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。