Python comments, script parameters, bytecode

Source: Internet
Author: User

python comments, script parameters, bytecode

--Tao Xin

python installation

1. Download the installation package

https://www.python.org/downloads/

2. Installation

Default installation path: C:\python27

3. Configure Environment variables

"Right-click Computer"-"Properties"-"Advanced system Settings"-"Advanced"-"Environment variable"-"in the second content box to find the variable named path of a row, double-click"-"Python installation directory appended to the variable value, with;

such as: the original value; C:\python27, remember that there's a semicolon in front

NotesSingle-line Comment #

eg

#   print "123"
Multiline comment "" "" ""

(three quotes start, end)

eg

“””

Import Sys

Print SYS.ARGV

print ' Hello, world '

“””

Style= "Background-color: #ff0000;" > Script Parameters

Python has a large number of modules, which makes developing Python programs very concise. The class library includes three:

    • Python-supplied modules
    • Industry-Open Source modules
    • Modules developed by programmers themselves

eg

New hello.py

#!/usr/bin/env python

#-*-Coding:utf-8-*-

Import Sys

Print SYS.ARGV

print ' Hello, world '

#捕获参数

Input: Python hello.py localhost:8001

Output: [' hello.py ', ' localhost:8001 ']

Hello, world

byte code

eg

New hello.py File

#!/usr/bin/env python

#-*-Coding:utf-8-*-

print ' Hello, world '

#字节码

Import m

print "Hello"

New m.py File

#!/usr/bin/env python

#-*-Coding:utf-8-*-

print "Hello Daoxin"

Input: Python hello.py localhost:8001

Output: Hello, world

Hello Daoxin

Hello

Execution process: hello.py will import the module in m.py

Note: If M.PYC performs the same function as m.py, execute the M.PYC directly; If the function is not the same, the execution m.py after the formation of M.PYC re-execution

Python comments, script parameters, bytecode

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.