python notes 、 Script parameters 、 Bytecode

-- The heart

python install

1、 Download installation package

2、 install

Default installation path :C:\python27

3、 Configure environment variables

【 Right click the computer 】--》【 attribute 】--》【 Advanced system setup 】--》【 senior 】--》【 environment variable 】--》【 Find... In the second content box A variable called Path A line , double-click 】 --> 【Python The installation directory is appended to the variable value , use ; Division 】

Such as : The value of the original ;C:\python27, Remember that there is a semicolon in front of you


Single-line comments      #


 # print “123”

Multiline comment    “””            “””

( Start with three quotes 、 end )



import sys

print sys.argv

print ' Hello , The world '


style="background-color: #ff0000;"> Script parameters

Python There are a lot of modules , So that development Python The program is very simple . Class library includes three middle schools :

  • Python Internal modules
  • Open source modules in the industry
  • Modules developed by programmers themselves


newly build

#!/usr/bin/env python

# -*- coding:utf-8 -*-

import sys

print sys.argv

print ' Hello , The world '

# Capture parameters

Input : python  localhost:8001

Output : ['', 'localhost:8001']

Hello , The world



newly build file

#!/usr/bin/env python

# -*- coding:utf-8 -*-

print ' Hello , The world '

# Bytecode

import m

print "hello"

newly build file

#!/usr/bin/env python

# -*- coding:utf-8 -*-

print "hello daoxin"

Input :python  localhost:8001

Output : Hello , The world

hello daoxin


Execution process : Will import The mold in

Be careful : If m.pyc And Perform the same function , Direct execution m.pyc ; If the function is different , perform Post formation m.pyc Re execution

python notes 、 Script parameters 、 More about bytecode

  1. python Decompilation bytecode

    If you've ever written or used Python, You may be used to seeing Python Source code file : Their names are .Py ending . Another type of document you may have seen is .pyc At the end of the , They are Python " word ...

  2. Python String and bytecode conversion

    A picture to understand python String and bytecode conversion  

  3. 【 turn 】 Use cocos2d-console Tool to convert script to bytecode

    from Cocos2D-X v2.1.4 Version start , Added Cocos2D-console Command line tools , One of the features of the tool is : hold .js The file is converted to .jsc file , The file is in bytecode format , Can improve code security . Use this ...

  4. Python How to compile a file into bytecode

    In general python There is no need to manually compile bytecode . But if you don't want to be direct release Source code for others , Compile the file into bytecode , Can achieve a certain degree of information hiding . 1) Using modules py_compile Compile a single file ...

  5. python Script parameters for optparse

    import optparse usage = "myprog[ -f <filename>][-s <xyz>] arg1[,arg2..]" opter ...

  6. Python Of top-level Why does the script have no corresponding bytecode on the disk ?

    stay Python in , If you use python It works in this way Python Script , that This is called top-level Script . about Python Come on , The bytecode of this script will not be written to disk ...

  7. Python reverse ( 5、 ... and )—— Python Bytecode interpretation

    One . Preface In the previous chapters, we discussed python compile . The principle of disassembly and related modules have been interpreted . Readers should have a preliminary grasp of how to get python The ability of a program to read bytecode .python The purpose of reverse or disassembly is on the basis of no source code , ...

  8. Python What is bytecode

    understand Python What is bytecode ,Python How to use it to execute your code , And how it helps you . If you've ever written Python, Or just used Python, You may often see Python Original generation ...

  9. Python Bytecode Introduction

    understand Python What is bytecode ,Python How to use it to execute your code , And how it helps you . If you've ever written Python, Or just used Python, You may often see Python Source code ...

  10. python Bytecode is dead

    Preface :   If you're like me , Yes python Bytecode of interest , Want to know python How does the code run in memory , So you can keep looking down , If you are python Novice , I suggest you move elsewhere , This article is suitable for some basic pyth ...

Random recommendation

  1. JAVA Thread lock - Read write lock application , Simple caching system

    stay JAVA1.5 After the version ,JAVA API Provided in ReadWriteLock, This class is an interface , In its implementation class ReentrantReadWriteLock There is such a code in class CachedDat ...

  2. strong reference cycle in block

    However, because the reference is weak, the object that self points to could be deallocated while th ...

  3. python3 Capture dynamic pictures of asynchronous Baidu waterfall flow ( Two )get、json Download the code to explain

    How to make and analyze the website get def gethtml(url,postdata): header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; ...

  4. In the header file #ifndef/#define/#endif The role of

    In a big software project , There may be multiple files containing a header file at the same time , When these files are compiled and linked into an executable file , There will be a lot of redefinition errors . In the header file utility #ifndef #define #endif It can avoid the reset of header file ...

  5. Apache Secondary domain name configuration method

    The following Apache The secondary domain name configuration method is in other BBS What you see , I used to configure every virtual directory. Today I'm thinking about how to write it. I didn't expect to find it . Apache Second level domain name implementation method introduction First , You have a top with Pan domain name resolution ...

  6. CodeForces 711A Bus to Udayland ( Water problem )

    The question : Given a n*4 Matrix , then O Empty seat ,X It means that someone is already there , You can't find a pair of adjacent seats , Are empty , And the first two are a couple , The last two are a couple . Analysis : Just look for it directly . The code is as follows : #pragma commen ...

  7. 【 Question notes 】VS2012 Can't enter code , written words &hellip;

    The first time I met , Very strange , A project ,VS2012 Can open normally , But you can't enter the code . Comparative analysis found that , Other projects work well work. One problem is that ,VS2012 There's a... in the lower right corner INS All the time, all the time analyzing, And normal ...

  8. css in calc Invalid property value problem

    width:calc(50%-20px); It's invalid to write like this because calc There must be a space between the two factors calculated in and the operation symbol :

  9. less Environment installation and construction

    less: Less It's a door CSS Preprocessing language , It expands CSS Language , Added variables such as . blend (mixin). Functions and so on , Give Way CSS Easier to maintain . Easy to make theme . expand .Less Can run in Node Or Liu ...

  10. SQLAlchemy Summary of operating methods

    Reference resources 1. Inquire about : # Simple query print(session.query(User).all()) print(session.query(, User.fullname).all()) ...