Python is known as the world's most efficient programming language, but also known as the "glue language", then why it is so popular, so let's say that Python introductory learning must have 11 points of knowledge, that is why it can be so popular reason, This article is mainly to share with you 11 Python entry knowledge points, hope to help everyone.
About Python
Python is a high-level scripting language that combines explanatory, compiled, interactive, and object-oriented.
Python's design is highly readable, with English keywords often used in other languages, some punctuation in other languages, and it has a more distinctive grammatical structure than other languages.
Python is an interpreted language: this means that there is no compilation in the development process. Similar to the PHP and Perl languages.
Python is an interactive language: This means that you can execute your program in a Python prompt directly interacting with the execution.
Python is an object-oriented language: This means that Python supports object-oriented styles or code encapsulation in object programming techniques.
Python is a beginner's language: Python is a great language for novice programmers, and it supports a wide range of application development, from simple word processing to WWW browser to gaming.
Python Development History
Python was designed by Guido van Rossum in the late 80 and early 90 at the Dutch National Institute of Mathematics and Computer science.
Python itself is developed in many other languages, including ABC, Modula-3, C, C + +, Algol-68, SmallTalk, Unix Shell, and other scripting languages, among others.
Like the Perl language, the Python source code also follows the GPL (GNU general public License) protocol.
Now that Python is being maintained by a core development team, Guido van Rossum still occupies a vital role in guiding its progress.
Python Features
1. Easy to learn: Python has a relatively small number of keywords, simple structure, and a well-defined syntax to learn more easily.
2. Easy to read: Python code definition is clearer.
3. Easy maintenance: The success of Python is that its source code is fairly easy to maintain.
4. An extensive standard library: one of the biggest advantages of Python is the rich library, cross-platform, compatible with Unix,windows and Macintosh very well.
5. Interactive mode: Interactive mode of support, you can enter the execution code from the terminal and obtain the results of the language, interactive testing and debugging code snippets.
6. Portable: Based on its open source features, Python has been ported (that is, making it work) to many platforms.
7. Extensible: If you need a critical code that runs fast, or if you want to write some algorithms that you don't like to open, you can use C or C + + to complete that part of the program and then call it from your Python program.
8. Database: Python provides the interface for all major business databases.
9.GUI Programming: Python support GUI can be created and ported to many system calls.
10. Embeddable: You can embed python in a C + + program to give your program's users the ability to "script".
1. What are the application scenarios for Python?
This has no fixed answer, and many people say that Python is not suitable for developing GUI programs, but Python's own ide--idel and third-party ide--eric are written by Python.
Now see more people are to write the Web, using such as Django, web.py framework, remember the wrong flask is also.
There is also a situation with more, using Python as glue, with a variety of languages, together to complete a software function, pay attention to observe perhaps you will find in the installation of some software will have Python figure.
I personally also take Python to simulate port forwarding and DNS services, so really is to see the real use, and not how to use.
In addition, big data analysis Python is also more suitable, from loading to analysis, and then to save the results, Python has a set of modules to deal with.
2. Is python capable of big data?
Python is well suited for large data-related analysis, and the built-in C-compiled module can handle common operations, and individual extreme algorithms recommend C to rewrite related modules.
The characteristics of Python itself is more efficient development and simple maintenance, speed to C go, more problems in fact, the people who write code is not better use, rather than inefficient. such as sorting, Python has a very efficient built-in C-compiler module, but not to write their own algorithm, so the result is not slow is strange.
It also depends on whether the requirements are CPU-intensive or IO-intensive, and if the CPU-intensive recommendations are implemented by C, IO-intensive efficiency will not change as much as Python.
C's efficiency is high, but the frame is also laborious, so it is combined with it, and therefore, Python is called glue language.
3. Can python completely replace the shell?
Completely, the functionality of the Shell Python can be implemented, and the code is less, better structure, more readable, and Python can implement the functionality of the shell is not necessarily able, such as the operation of the use of the socket for network communication, the Web-enabled Django framework, Psutil modules for performance acquisition, and the Shell has a strong command dependency on the operating system, Python can be circumvented to a greater extent.
In a shell IDE is a big problem, although Python's native IDE is not good, but the third-party IDE is very powerful, although not comparable to Microsoft's virtual studio, but also can fully meet the development needs of Python.
In the case of Python's efficiency, Python supports multi-process, multi-threaded, and co-threading (smaller than thread), and program concurrency is on the shell. Python's core modules are basically implemented in C and are therefore more efficient. If necessary, Python modules that need to be implemented in Python can be rewritten in C to improve efficiency and, of course, directly with C python, a Python interpreter that is implemented directly and completely in C.
4. Does python have access to common databases?
Yes, Python can access a variety of common databases, such as Oracle, MySQL, Vertica, SQL Server, and so on, to load the appropriate modules, the module list is as follows:
Oracle:cx_oracle
Mysql:mysqldb
5. Is the development of Python oriented to process, function or object?
Although Python is an interpreted language, it has been an object-oriented language since its inception, and it is an object for Python. Because of this, it is easy to create a class and object in Python, but if you are accustomed to writing a procedure or function, Python does not make a hard limit.
The object-oriented features of Python are as follows:
Packaging
The term object in object-oriented programming is basically a collection of data (attributes) and a series of methods that can access and manipulate the data. The traditional "program = data structure + algorithm" is encapsulated "masked" and simplified to "program = object + Message". An object is an instance of a class, and the abstraction of a class needs to be encapsulated. Encapsulation allows callers to use directly without worrying about how objects are built.
Inherited
Class Inheritance:
The direct feeling of inheriting is that this is a code of reuse behavior. Inheritance can be understood as the creation of a specialized class object based on a common class, and the subclass and its inherited parent class are is-a relationships.
Multiple inheritance:
Unlike C#,python, which supports multiple class inheritance (C # can inherit from more than one interface, but inherit from a class at most). Multiple inheritance mechanisms are sometimes useful, but it's easy to complicate things.
Polymorphic
Polymorphism means that the same action can be used on different objects, but they may present results in a variety of shapes. In Python, polymorphism is used when you do not know what the object is, but need to do something about it. The method is polymorphic and the operator is polymorphic.
6, how to quickly master Python?
Read the official documentation to meet your daily needs, and the official documents are translated in Chinese to facilitate learning. But these are basic grammar and common modules, Python learning is important module, fast and efficient development depends on the application of the module, standing on the shoulders of predecessors will save time and effort.
But the most important thing to learn about Python is the learning module, not the grammar itself, the Python syntax is very simple, as long as the university has studied C or the data structure course, even people who have not learned it can be easily mastered. Mastering the syntax can already implement the Shell function, but to improve the module's learning is essential, such as operations and maintenance personnel often use:
Psutil: Getting performance information
Socket: Basic network communication
IPY:IP Address related processing
Dnsptyhon: Domain name related processing
Difflib: File Comparison
Pexpect: Screen information acquisition, often used for automation
PARAMIKO:SSH Client
Xlsxwriter:excel related Treatment
There are many other functional modules, and every day there are new modules, frameworks, components, such as PYTHONJS for bridging with Java, and even python can write maps and reduce.
7. Does Python have a dedicated IDE tool?
There are Python IDE tools that Idel Python implements, but honestly, the features are really not right. My personal favorite IDE is as follows:
Pycharm
Pycharm is a python IDE developed by JetBrains. Pycharm is used in general IDE features such as debugging, syntax highlighting, project management, code jumps, smart tips, AutoComplete, Unit testing, versioning ... In addition, Pycharm offers some great features for Django development, while supporting Google App Engine, and, more cool, pycharm support ironpython!
Wing IDE
The Wingware Python IDE is compatible with Python 2.x and 3.x, and can be combined with django,matplotlib,zope, Plone,app ENGINE,PYQT,PYSIDE,WXPYTHON,PYGTK, Used by Tkinter,mod_wsgi,pygame,maya,motionbuilder,nuke,blender and other Python frameworks. Wing supports test-driven development with integrated unit testing, nose and Django framework execution and debugging capabilities. The Wing IDE starts and runs very fast, supporting Windows,linux,os x and Python versi.
notepad++
Simple and convenient, but only for temporary changes.
Other: Eclipse Withpydev, Sublime Text, Komodo Edit, Pyer, the Eric python IDE, Interactive Editor for Python
8. What are the common methods of using Python to realize system automation monitoring?
Exactly what should be the module, health monitoring must have psutil to monitor performance, will also use the communication socket, landing Paramiko, Telnetlib,ftp ftplib.
The basic principle is to collect data-local processing of data-transfer data, if done more perfect can do a presentation of data, you can also send data to Zabbix and other open source tools.
Individuals also use an open source monitoring network spying, more than a specified number of automatic block.
9. Can python run on those platforms? What is the cross-platform?
Supports common mainstream platforms such as AIX, HPUX, Solaris, Linux, Windows, etc., UNIX, Linux platforms that are common except for Windows, have native Python, but generally have a lower version. As for cross-platform and his cross-platform language, it is important to note that some individual modules are unique to a single platform, and that the overall cross-platform is good enough not to write multiple sets of code to accommodate multiple platforms.
But this is not to say that there is no limit: first, the same version of the intermediate file. Py and. PYc and. Pyo are cross-platform; second, PC and mobile terminal, such as: mobile phone, pad can not cross platform (for the next one); Finally, you cannot cross processor architectures such as Intel and arm,64 bits with 32-bit.
10, how to use Python to improve development efficiency?
Because Python has a lot of bottom-level stuff that doesn't have to be written on its own, the modules are resource-rich, and the efficiency of development is certainly improved, and frameworks provide the foundation for rapid development.
11. How fast is Python running?
Java is usually faster than python. Python calls except for the C extension (can also be used directly with CPython).
For the criticism of Python's slow speed, Python language author Guido van Rossum says:
If you develop a system that discovers performance bottlenecks, it is often most efficient to find the offending block of code, write some code in a faster language such as C or C + + to replace the function or the module, instead of rewriting the entire system in C or C + +, because the speed of the language is irrelevant for most code.
Learning is a person's greatest accomplishment, through learning not only can improve their own realm, but also enrich knowledge, for the future employment lay the foundation, Learning Python is a good opportunity to develop their own, after all, the AI era has come, python as the main force of the AI era is very promising, The dream is not rotten, all the way there is sweat flow. Come on!
List of recommended books:
The python Daniel in your eyes should have this list of books.
Python book list does not
10 good Python books to be missed