Python data Types-notes for the Python 3 Program development Guide

Source: Internet
Author: User

Reference: "Python 3 Program Development Guide"

integer Conversion Functions :

Bin (i) Returns the binary representation of the integer I (string)
Hex (i)

Returns the hexadecimal representation of I (String)

int (x) Converts an X to an integer, fails to produce an ValueError exception, the data type of x does not know that the conversion of an integer produces an typeerror exception, and X is a floating-point number to intercept an integral part
Int (x,base) Converts the x represented by the base into decimal, such as int (' 74 ', 8) returns 60,int (' A4 ', 16) returns 164
Oct (i) Returns the octal representation of I, such as the OCT (10) = = ' 012 '

String slices:

There are 3 types of syntax for slicing operations:

Seq[start]

Seq[start:end]

Seq[start:end:step]

SEQ can be any sequence, such as a list, a string, or a meta-ancestor

>>> s= ' The waxwork man ' >>> s = s[:12] + ' wo ' + s[12:]>>> s ' The waxwork woman ' >>> s[::- 1] ' Namow krowxaw EhT '

Python data Types-notes for the Python 3 Program development Guide

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.