Introduction to the start 001 Python Python (not completed)

2010-11-28  来源:本站原创  分类:Python  人气:86 

Python has three ways to start. The simplest is to start the interactive interpreter, each input line of Python code to execute. Another way to start is to run Python Python script. The third way is to run in the IDE Python.

One. Interactive interpreter
1.Unix derivative systems (Linux, MacOSX, Solaris, FreeBSD, etc.)
(1) the implementation of the Python file search path added to the system
(2) in the shell terminal and type python (2.X) or python3.2 (3.X)
Started successfully, you see information about the interpreter, that Python's version number and platform information, and finally display the interpreter Python command prompt ">>>" waiting for input.

2.Windows environment
(1) Python installation path to the PATH environment variable.
(2) in the CMD console, you can enter Python.

Second, in order to run the script
1.Unix derivative versions
(1) command line operation. Using python script.py.
(2) Unix can automatically execute the script. The first line of the script with shell magic string:

#! / Usr / local / bin / python.

#! After the set is the full path to Python interpreter.
Can also be written #! / Usr / bin / env python. Where "/ user / bin / env" env command is the path. Different platforms may be inconsistent. With this line of string, then set the script executable, you can directly enter the file name (including suffix) to execute the script.

2.Windows environment in the command line, enter the script name, or double-click the script file can execute the script.

Script suffix can have two types of py, the other is pyw. There will be an implementation of the console before

Window, the latter does not.

3. The source file encoding with the first line in the file # -*- coding: encoding -*-
3.X default is UTF-8, 2.X default is ASCII

Third, the interactive startup file
When using the interactive interpreter, once again exit the interpreter comes in, do some operations before

Are not saved. You can use a startup file in the file to perform some common operations. Then

PYTHONSTARTUP then set the environment variable specified file path.

Fourth, the input and output redirection
script.py <inputfile
script.py> outputfile
script.py>> outputfile
The first is the redirected input.
The second and third are redirecting the output, just append the end of the third file in the specified content,

And two will be added to empty the contents of the file.

V. Detailed command line arguments
Detailed applies only to the CPython, other implementations may vary.
1. Command line syntax
python [-bBdEhiOsSuvVWx?] [-c command |-m module-name | script |

-] [Args]

To be added ... ...

相关文章
  • Introduction to the start 001 Python Python (not completed) 2010-11-28

    Python has three ways to start. The simplest is to start the interactive interpreter, each input line of Python code to execute. Another way to start is to run Python Python script. The third way is to run in the IDE Python. One. Interactive interpre

  • Zen zen of python python 2010-05-28

    Some fans feel are talented python, had seen "python Eight Honors and Eight Shames", also "python rose Declaration", this time to see a "zen of python" (python of Zen). Prior to learning php When not seen such things. The Zen

  • 比较 Python(Python 与其他语言的比较) 2012-08-07

    ---------<PYTHON核心编程> 比较 Python(Python 与其他语言的比较) Python 已经和很多语言比较过了. 一个原因就是 Python 提供了很多其他语言拥有的特性. 另外一个原因就是 Python 本身也是由诸多其他语言发展而来的,这包括 ABC.Modula-3.C.C++.Algol-68.SmallTalk.Unix shell 和其他的脚本语言等等.Python 就是"浓缩的精华 ":范·罗萨姆研究过很多语言,从中吸收了许多觉得不错的

  • graphics library python Python Imaging Library (PIL) Introduction and Installation (Reprinted Collection) 2010-10-14

    [Introduction] Two days to write a program with python, the need for a variety of formats handled some simple pictures, using the Python Imaging Library (PIL) library, the library can be used for some common operating picture, such as changing the im

  • a collection of Python python learning materials learning materials 2010-05-25

    http://blog.chinaunix.net/u2/84280/showart_1424045.html Python basic installation: * Http://www.python.org/ Python official standard development kit and support the environment, but also Python's official website; * Http://www.activestate.com/ integr

  • python is something --- python --- python's httpsever 2010-07-13

    # -*- coding:UTF-8 -*- import os import BaseHTTPServer import time import threading import urlparse class ServerHandler(BaseHTTPServer.BaseHTTPRequestHandler): # def __init__(self,request, client_address, server): # BaseHTTPServer.BaseHTTPRequestHand

  • What python is the httpsever --- python --- python 2010-07-13

    # -*- coding:UTF-8 -*- import os import BaseHTTPServer import time import threading import urlparse class ServerHandler(BaseHTTPServer.BaseHTTPRequestHandler): # def __init__(self,request, client_address, server): # BaseHTTPServer.BaseHTTPRequestHand

  • python is what the characters --- python --- python handling 2010-07-26

    # -*- coding:UTF-8 -*- """ Character processing tools : Unicode to determine whether the Chinese , Japanese, figures , English, or other characters . Full-width half-width symbols sign transfer .""" def is_unicode(self, uchar

  • Introduction to Syntax Summary python 2010-05-31

    1.python Is an interpreted language : One with a compiled language such as C or C++ The program can write files from the source ( The C or C++ Language ) Convert to a language of your computer ( Binary code, that is, 0 And 1). Through this process, t

  • A. Python Introduction 2010-09-16

    Chinese documents http://www.woodpecker.org.cn:9081/doc/abyteofpython_cn/chinese/index.html Download python, set the path environment variable, that is, the directory where python With the prompt of the interpreter used to run python.exe, or appear t

  • Python 2.5 Quick Reference 2010-06-21

    Python 2.5 Quick Reference Collection <script type="text/javascript"> document.body.oncopy = function () (if (window.clipboardData) (setTimeout (function () (var text = clipboardData.getData ("text"); if (text & ; & text.

  • Common library python! 2010-07-01

    Learning Python On this page ... (basic installation 2. Python Documentation 2.1 Recommended resource sites 2.2 Other references 2.3 Code Sample 3. Useful Tools 3.1 Python IDE 3.2 Built-in library to use reference 3.3 Common third-party libraries 3.4

  • Getting Started with Python 2010-08-27

    1 Introduction Python scripting language has the most rich and powerful class libraries, sufficient to support the vast majority of everyday applications. Its name comes from a comedy, perhaps the first person who designed the language Python and Pyt

  • Some Python programming article online 2010-09-01

    newthreading - safer concurrency for Python security concurrency (1 response) http://www.starming.com/index.php?action=plugin&v=wave&tpl=union&ac=viewgrouppost&gid=73&tid=7607 Several Google App Engine open source program http://www.st

  • Views python weight - OOP 2010-10-07

    wo-03 10-07 dfeixtay original python OOP foundation View the complete set today when heavy rush to learn python, found to be a high school teacher is an old saying, a lot of knowledge of many books, the first pass to see, understand, you put it down,

  • [Reserved] python mysql link 2010-11-02

    1. In http://sourceforge.net/projects/mysql-python/ download package needed to connect, MysqlDB. The latest version is 1.2.1_p2 (for * NIX) or 1.2.0 (for i386), I use the i386 version, the following are an example to 1.2.0. 2. Download and install, i

  • useful sites for learning python 2010-11-26

    Python Language Study == Overview == . For a programming language, syntax is the most intuitive performance, a variety of class library API is the most direct application. . But under the surface, the infrastructure of language, models, principles an

  • Python development environment related presentations 2011-05-22

    Recommendation 2 describes the preferred development environment is a good article: Beginners must know Python: Python development environment to run and python IDE comparison with the recommended In windows, I have tried that comes with Python IDLE,

  • summary of common problems linked mysql python 2011-05-26

    Python and Mysql First, install the python MySQLdb module Mysql connecting the premise is the need for a python to connect to Mysql interface, this is the MySQLdb module. Verify that installed the MySQLdb: ============================================

  • Lxml Python written using the high-performance XML parsing 2011-05-27

    Lxml Python written using the high-performance XML parsing Break a full-featured XML parsing and serialization package restrictions Liza Daly , Software Engineer, WSO2 Inc Introduction: lxml is written using the Python library, you can quickly and fl