Python-Basic data types

Source: Internet
Author: User

Operator:

1. Arithmetic operations:

2. comparison operation:

3. Assignment Operation:

4. Logic operation:

5. Member Operations:

Basic data type:

1. Number:

int (integral type)

On a 32-bit machine, the number of integers is 32 bits, the range is -2**31 ~ 2**31-1, i.e.-2147483648 ~ 2147483648

On a 64-bit machine, the number of integers is 64 bits and the range is -2**63 ~ 2**63-1, which is -9223372036854775808~9223372036854775807

2. Boolean value:

True or False 1 or 0

3. String:

"Hello World"

string concatenation: The string in Python is embodied in the C language as a character array, each time you create a string, you need to open a contiguous space in memory, and you need to modify the string, you need to open up again, the evil + every occurrence will re-open in memory space

String formatting:

" Alex " Print ("My name is%s")% nameprint ("my nameis" ), name

(String is%s, integer is%d, floating-point number is%f)

String Common functions:

Remove whitespace

Segmentation

Length

Index

Slice

Python-Basic data types

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.