[] Python1 know Python (Python Introduction, advantages and disadvantages, applications), python commonly used commands, ipython usage

Python's history

  1. Christmas 1989: Guido von Rossum began to write Python language compiler.
  2. February 1991: The first Python compiler (also interpreter) was born, which is implemented in C (later), you can call the C language library functions. In the earliest version, Python has provided support for the "class", "function", "exception handling" and other building blocks, as well as for lists, dictionaries and other core data types, supports module-based application to construct .
  3. January 1994: Python 1.0 released.
  4. 2000 October 16: Python 2.0 release adds complete garbage collection , provides Unicode support. At the same time, Python's entire development process more transparent, impact on community development progress gradually expanding ecosystem slowly began to form.
  5. 2008 December 3: Python 3.0 release, it is not fully compatible with previous Python code, but because there are many companies currently use Python 2.x version of the project and operation and maintenance, so many new Python 3.x characteristic was also later ported to Python 2.6 / 2.7 version.

Python's strengths and weaknesses

Python's advantages are many, simple can be summarized as follows.

  1. Simple and clear, do one thing only one way.
  2. Low learning curve compared with many other languages, Python is easier to use.
  3. Open source, has a strong community and ecosystem.
  4. Interpreted language, inherently platform portability.
  5. Of the two mainstream programming paradigm (object-oriented programming and functional programming) have provided support.
  6. Scalability and embeddable, for example, may be invoked in Python C / C ++ code.
  7. High degree of standardized codes, readable, there are codes for obsessive compulsive disorder and crowd.

Python shortcomings mainly in the following points.

  1. Slightly lower efficiency and therefore computationally intensive tasks can be written in C / C ++.
  2. Code can not be encrypted, but now many companies do not sell software sales but sales service, the issue will be weakened.
  3. Too many in the development framework that can be selected (such as Web framework there are more than 100), have a choice where there is an error.

Python applications

Currently the Python Web application development, cloud infrastructure, DevOps, network data collection (reptiles), data mining analytics, machine learning have a wide range of applications, and therefore also had a back-end Web development, data interface development, operation and maintenance of automation , automated testing, scientific computing and visualization, data analysis, quantitative trading, robot development, natural language processing, image recognition and a series of related posts.

Python commonly used commands

pip is a modern, versatile package management tools Python [1]   . Python provides a lookup of the packet, download, install, uninstall function.

Examples of official pip

$ pip install requests

$ pip search xml

$ pip show beautifulsoup4

$ pip uninstall requests

Command in cmd windows system by direct command, the following common

Usage:

pip <command> [options]

The Commands:
the install  [installation package ( the Install Packages. )]

download  [Download download package (  the Download Packages Standard Package .)]

uninstall  [Uninstall uninstall package (  Uninstall Packages Standard Package .)]

freeze  [freeze-demand format output packets installed ( the Output Installed Packages Standard Package requirements in format. )]

list  [list list of installed packages (  List Installed Packages Standard Package .)]

show  [information package (displays installed  Show the About Installed Packages Standard Package Information .)]

check  [check the installed packages are compatible with a dependency (  the Verify Installed Packages Standard Package have have the Dependencies compatible.) ]

config  [configuration management of local and global configuration (  the Manage, Ltd. Free Join local and the Configuration .)]

search  [search PyPI find packages ( Search for PyPI Packages Standard Package .)]

wheel  [to build the wheel according to your needs ( Build Wheels from your requirements. )]

hash  [archive of computing the hash hash (  the Compute Package of the hashes of Archives. )]

completion  [assist command for a command completion (  A Helper Command Command Used for completion. )]

debug  [display useful for debugging information (  Show Useful Information for the debugging .)]

help  [Help Display help command ( Show help for Commands .)]

1.cd F: \ python switching to F: \ python directory, directly enter the next input line to enter the letter F :, F: \ python directory

2.dir display files in this directory (browse)

3.mkdir zy zy create a folder named

4.rmdir zy zy delete the directory named

5.Ipconfig View IP address

6.ping test network connectivity amount

7.python into the python compiler environment

8.python --version confirm python version

9.exit () to launch python compiler environment

10.pip list lists the existing toolkit

View 11.pip -V version of pip

12.pip install redis (package name) installation kit package called redis, the installation directory in python / Lib / site-packages

13.pip uninstall redis (package name) Uninstall Tool package called package redis

14.pip install redis == 3.2.0 If you already have different versions redis toolkit will uninstall it and then install version 3.2.0 of redis Kit

15.pip list --help command to view the list of help

16.pip freeze -r requirements.txt find the file named requirements.txt

17.pip freeze> requirements.txt requirements.txt If you do not file this new file, and then pip freeze all the documents in this file input

18. The pip list> requirements.txt    will pip list of all the input file directory, if no requirements.txt file new file

19. The PIP install -r requirements.txt    install all the files in the requirements.txt

        These two commands are generally used for replacing the compiler environment, the corresponding installation package file.

(1) to the output of the local environment of the package file

(2) The package installation directory

20.python -m pip install --upgarde pip pip upgrade

 

        In a previous blog has explained in detail how to install the python compiler environment under the windows, the following terms are several ways to run the python:

1. Use a file that comes with Python IDLE to write a code file stored on the desktop, at the end of .py

(1) Run run directly IDLE find the page that opens

(2) windows + r + cmd into the command line on the page, enter the directory to save the file, I saved on the desktop

Then use the file name to run python +

(3) files directly dragged into the open box press Enter to run the command

2. Use the sublime compiler to run python file

Located Sublime: Https://Jingyan.Baidu.Com/article/d3b74d6418a8381f76e60955.Html

https://www.jianshu.com/p/493fafa2bace

Baidu look how sublime configured so that it can run python program, and then create, save as .py files, Build shortcut usually Ctrl + B

  • First, through the official website Text 2 Installation Sublime Sublime Text 3 or download the installer.

  • Installation package management tools.

    1. Ctrl + `shortcut key or selecting Show Console console Open the View menu, enter the following code.
    • Sublime 3
    import  urllib.request,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib.request.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
    • Sublime 2
    import  urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp)ifnotos.path.exists(ipp)elseNone;urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read());print('Please restart Sublime Text to finish installation')
                 2. Enter in the browser  https://sublime.wbond.net/Package%20Control.sublime-package  download the installation package package management tools, and found under the installation directory Sublime directory named "Installed Packages" and the just downloaded files into the file plus the next, and then restart Sublime Text to get.
  • Install the plugin. Open a command panel by the Package Control Preference menu or shortcut keys Ctrl + Shift + P, enter the Install Package panel can be found in the tools installed plug-ins, and then look for plug-ins required. We recommend that you install the following plug-ins:

    • SublimeCodeIntel - automatic code completion tool plug.
    • Emmet - front-end development code templates plugins.
    • Git - version control tool plug-ins.
    • Python PEP8 Autoformat - PEP8 automatic formatting specification plug.
    • ConvertToUTF8 - convert a local encoded as UTF-8.

How can I see which plugins are installed sublime:

Press ctrl + shift + p, enter the package, select list packages, saw.

Or directly View Installed Packages directory.

3. few common errors word

 Define defined

SyntaxError Syntax error

Invalid invalid

Character Character

4.PyCharm - - - Python development Artifact (subsequent re-write an article specifically in terms of it)

ipython usage

First, use the command pip install ipython installation ipython, then enter ipython ipython build environment

IPython is an interactive computing system. It comprises three main components: an increased interactive "Python shell", double model decoupling process communication, interactive parallel computing architecture. Support variable completion.

IPython is a python interactive shell, much more than the default python shell easy to use, support for variable auto-completion, auto-indent, support bash shell commands, built a lot of features and useful functions.

IPython is based on the BSD open source.

IPython provides a rich framework for interactive computing, include:

  • Powerful interactive shell

  • Jupyter kernel

  • Interactive data visualization tools

  • Flexible, embedded interpreter

  • Easy to use, high-performance parallel computing tools

Published 46 original articles · won praise 18 · views 30000 +

Guess you like

Origin blog.csdn.net/IGGIRing/article/details/105028402