python3.5 Learn chapter II (1) standard library, bytes

Source: Internet
Author: User

One, the path of the output Python library:

1.sys Standard Library

Import Sys
Print (Sys.path)

Results:

' E:\\python Practice \\python35 Learning \\Day2 ',

' E:\\python Practice \\python35 learning ',

' D:\\python\\lib ', ' F:\\pjproject-2.7\\tests\\pjsua ',

' C:\\users\\asus\\appdata\\local\\programs\\python\\python36\\python36.zip ',

' C:\\users\\asus\\appdata\\local\\programs\\python\\python36\\dlls ',

'c:\\users\\asus\\appdata\\local\\programs\\python\\python36\\lib ', the location of the standard library

' C:\\users\\asus\\appdata\\local\\programs\\python\\python36 ',

Location of the ' c:\\users\\asus\\appdata\\local\\programs\\python\\python36\\lib\\site-packages ' three-party library

2.os Standard Library

Import OS
#os. System ("dir") #执行命令, output to screen without saving results
Cmd_res=os.popen ("dir"). Read () #popen写入内存地址, read () reads from
Print (Cmd_res)
Os.mkdir ("Example")


Ii. Types of data
1. int integer
2. Floating-point numbers float 3.23 and 52.3E-4 (E represents the power of 10)
3. Boolean value 1 or 0
4.16 Binary representation
The character h suffix indicates that the EG:BH represents 16 binary number 11;
Represented by a 0x prefix, the eg:0x23 represents a 16 binary number of 23.
5.bytes type
In Python3, text is always Unicode, represented by the STR type, and binary data (audio, video) is represented by the bytes type.
(in Python3, the data transmission with the socket must be transmitted in binary form, so the STR type is converted to the bytes type)


Msg= "I'm learning Python3."
Print (msg)
Print (Msg.encode (encoding= ' utf-8 '))
Print (Msg.encode (' Utf-8 '). Decode (encoding= ' utf-8 '))
Results:

I'm learning Python3.
B ' \xe6\x88\x91\xe6\xad\xa3\xe5\x9c\xa8\xe5\xad\xa6\xe4\xb9\xa0python3 '
I'm learning Python3.



python3.5 Learn chapter II (1) standard library, bytes

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.