Retake Course day7 (basic Supplement to Python Foundation 4)

Source: Internet
Author: User

A bit, a relationship with bytes.

Bit: is the smallest representation unit of the computer.

Bytes: is the smallest storage unit of the computer.

1 bytes (bytes) = 8 bits (bit)

Format:

Print (bytes (' character ', encoding= ' Utf-8 '))    file read file by default

Other functions of the second strip

Strip remove the space on both sides, line breaks, tabs, and so on, you can also specify the deletion character

A= '  dsad  ' Print (A.strip ()) b= ' \ndsfsadagh\t ' Print (B.strip ()) print (123) c= ' FSDFDSGF ' Print (C.strip (' F '))

Three-Print supplement

Print has a line wrapping function, but in order to not let the line break, there is also a function is end, that is, you can not change line.

Print (123) print (456) print (123,end= ") print (456)

Four letters, numbers, underlined strings are optimized for processing----------save memory

The difference between the five python2 and the Python3:1 range and Xrange:python3 in the same range as the Xrange function in Python2.

2 Division sign (/): Python2 division sign is divisible, division sign in Python3 is accurate quotient

3 Print:python2 printing does not require parentheses, while python3 requires parentheses

4 input and Raw_input:python2 are the same as the input function in Raw_input and Python3

5 code: Python2 does not support the man, Python3 is supporting the man

Six Fromkeys do value on a mutable data type, modify one value, others will be affected, and your mutable data type will not be affected by value.

Retake Course day7 (basic Supplement to Python Foundation 4)

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.