String comparison technique used by Python

前端 未结 7 1977
心在旅途
心在旅途 2020-11-21 15:50

I\'m wondering how Python does string comparison, more specifically how it determines the outcome when a less than (<) or greater than (>) op

7条回答
  •  无人及你
    2020-11-21 16:13

    Strings are compared lexicographically using the numeric equivalents (the result of the built-in function ord()) of their characters. Unicode and 8-bit strings are fully interoperable in this behavior.

提交回复
热议问题