Python path --------- & gt; data type, python path ---------

Source: Internet
Author: User

Python path ---------> data type, python path ---------

Data Type

I. Basic Data Types

Integer: (int) for example: 0, 1, 2, 3,-4,-5 ......

Float: (float) for example: 1.00, 9.88, 8. 66 ...... etc.

Boolean: (boll) there are only two types, True and False)

Complex: (complex) for example: 6 + 4j,-5 + 88j, 98 + 9j...

TheInteger,Float,Boolean is easy to understand. Here we may only need to talk about the plural.

The complex () function can create a plural number using the real + imag * j parameter. You can also convert the number of a string to the plural value, or convert a number to the plural value. If the first parameter is a string and the second parameter is not required, the string is interpreted and the plural value is returned. However, the second parameter cannot be entered as a string; otherwise, an error occurs. Real and imag parameters can enter numbers. If the imag parameter is not input, it is a zero value by default. This function is equivalent to the int () or float () function. If the real and imag parameters both input zero, this function can easily convert a list into a plural form. Note: When you want to convert the plural form of a string to the plural form, no space exists in the string; otherwise, a ValueError exception is returned.

Code Description:

Ii. string type:

Single quotation mark string: for example, 'Hello'

Double quotation mark string: for example, "Hello"

String with three quotation marks: for example, "Hello" Or '''hello''. Note: The string contained in the three quotation marks can be composed of multiple lines, generally, it can represent the narrative string of a large segment. There is basically no difference in use, but double quotation marks and three quotation marks can contain single quotation marks, three quotation marks can contain double quotation marks, without escaping.

Substring:

Index operator starts from 0

The slicing operator [x: y] is the subscript starting from the x subscript to the Y-1 subscript.

Code Description:

List:

 

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.