Python's program structure [4]--function/function----built-in function

Source: Internet
Author: User
Tags chr ord

built-in functions /built-in function or Method

There are many built-in functions in Python (see the 3.6.1 section), where the built-in functions are described

built-in functions ord/built-in function ord

Python's built-in function, Ord, is to convert a single character in an ASCII code table to the corresponding decimal integer data .

>>> Ord ('b')  98  >>> ord ('c'  )  99  

built-in functions hex/built-in function Hex

Python's built-in function, Hex, converts a decimal integer data into a hexadecimal-represented string , and the hex differs from binascii.hexlify in that the hex accepts only the shaping data and does not accept the string.

>>> Hex (88)  '0x58'>>> 1.44. Hex ()'0x1.70a3d70a3d70ap+0'>>> Hex (' the') Traceback (most recent): File"<pyshell#2>", Line 1,inch<module>Hex (' the') TypeError:'Str'Object cannot is interpreted as an integer

built-in functions bin/built-in function bin

Python's built-in function is to convert a decimal integer data into a binary-represented string .

>>> bin (0b1011001)  '  >>> bin (3)   ' 0B11 '  

built-in functions otc/built-in function OTC

Python's built-in function The OTC effect is to convert a decimal integer data into an octal representation of a string .

>>> Oct (+)  '0o20'  >>> Oct (+)   '0o310'  

built-in functions chr/built-in function chr

Python's built-in function is to convert a decimal integer data into a single character corresponding to the ASCII code table.

>>> chr (98)  'b'    >>> chr  a'  

Python's program structure [4]--function/function----built-in function

Related Article

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.