Replacing CMP functions in Python2 in Python3

Source: Internet
Author: User

There are no CMP functions in the Python 3.4.3 version and are replaced by operator modules, which need to be imported when used in interactive mode.

In the absence of an import module, there will be

If the CMP function is not found, how do you use this function in Python3?
So to import the module


Look at the built-in functions given below

These functions are used to replace the previous CMP, and our fellow countrymen who used CMP before, we will change these functions later.

Let's just say the meaning of these few functions.

LT (A,b) is the equivalentof a <b from the first digit or letter (ASCII) size

Le (A,b) corresponds to a<=b

eq (A,b) equals a= =B letter Exactly, returns True,

NE (A,b) equals a!=b

GT (A,b) equivalent to a>b

GE (A,b) is equivalent to a>=b

The return value of the function is Boolean OH

Replacing CMP functions in Python2 in Python3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.