11 tips to help you get started with Python

Source: Internet
Author: User
Tags sublime text

With the popularization of mobile Internet, the challenges faced by server operation and maintenance are becoming more and more big. When the scale increases to a certain extent, the manual management method has not been able to deal with, automated operations to become a problem-solving silver bullet. Python, with its flexibility, has been widely used in automation operations, greatly improving operational efficiency, and the larger the size of server clusters, the more obvious the advantages. Here are some of the things you can do to get into Python's world.

1

What scenarios are python suitable for?

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 a common database?

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 Python development oriented to procedures, functions, or objects?

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:

1. Encapsulation

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.

2. Inheritance

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.

3. 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 script, 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, Pyscripter, the Eric python IDE, Interactive Editor for Python

8

What are the common methods of using Python for 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 kill,

9

What platforms can python run on? 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 can you 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. Learn python you need a good environment, a high-quality development of the communication group, the group is the kind of mutual help of talent is possible, I have to build a Python learning Exchange group, in the group we help each other, care for each other, share content, so the problem to help you more people, group number is 301, There are 056, and finally 051, so that you can find the group of great God aggregation, if you only want to help others, do not want to share or help others, please do not add, you will tell others this is a kind of sharing.

Learning is the best investment for oneself, and the opportunity belongs to the prepared person, this is a look at the face of the times, but the ultimate fight is strength. The gap between people is not the IQ, but how to use spare time, so there is no brilliant, only dry out of the wonderful. In fact, as long as you want to learn, when the start is not too late, do not worry about that, you just work hard, the rest of the time, and you have not become strong, only because you are not enough effort, to remember to pay as much as anyone's efforts.

Like friends can add QQ group 813622576, the group has free information for everyone to exchange learning

11 tips to help you get started with Python

Related Article

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.