Python module initial and data operations

Source: Internet
Author: User
Import SYS #导入sys库
Print (Sys.path) #打印环境变量
#print (SYS.ARGV) #sys. argv[] is used to get command-line arguments, Sys.argv[0] represents the file path of the code itself, such as "Python test.py-help" in the cmd command line, then sys.argv[0] represents " Test.py ".
Import OS #导入使用操作命令库
Os.system ("dir") #使用windows系统的操作命令
#print (Os.system) #使用变量命令
#cmd_res = Os.system ("dir")
#cmd_res = Os.popen ("dir"). Read () #执行并保存. Read Read
#print (Cmd_res)

#print (Msg.encode (encoding= "Utf-8")) #因为python3中使用的默认的UTF-8
#print (Msg.encode (encoding= "Utf-8"). Decode (encoding= "Utf-8"))
Quemengqiao = "Sunny Day"
Print (Quemengqiao)
Print (Quemengqiao.encode (encoding= "Utf-8")) #将字符串打印成二进制
Print (Quemengqiao.encode (encoding= "Utf-8"). Decode (encoding= "Utf-8") #将字符串转移编译成二进制在解码成字符串打印

Python module initial and data operations

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.