Python entry + advanced chapter 1st introduction to Python (it is not too late to start at any time)
1. Python Introduction1.1 Python concepts
Python /) it is a high-level scripting language that combines interpretation, compilation, interaction, and object-oriented.
The Design of Python is highly readable. Compared with other languages, it often uses English keywords and some punctuation marks in other languages. It has a more distinctive syntax structure than other languages.
Python is an interpreted language:This means there is no compilation link in the development process. Similar to PHP and Perl.
Python is an interactive language:This means that you can directly interact and execute your program at a Python prompt.
Python is an object-oriented language:This means that Python supports object-oriented style or code encapsulated in the object programming technology.
Python is a beginner's language:Python is a great language for beginners. It supports a wide range of application development, from simple text processing to WWW browsers to games.
1.2 Python features
1. Easy to learn:Python has a relatively small number of keywords, and the structure is simple. It is easier to learn with a clearly defined syntax.
2. Easy to read:Python code definition is clearer.
3. Easy Maintenance:Python's success lies in that its source code is quite easy to maintain.
4. A wide range of standard libraries:One of the biggest advantages of Python is its rich library, cross-platform, and compatible with UNIX, Windows, and Macintosh.
5. Interactive Mode:With the support of interactive mode, you can enter the language for executing code and obtaining results from the terminal, interactive testing and debugging code snippets.
6. Portability:Based on its open source code features, Python has been ported (that is, to make it work) to many platforms.
7. Scalability:If you need a piece of key code that runs very quickly, or want to write some algorithms that are unwilling to be opened, 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 interfaces for all major commercial databases.
9. GUI programming:Python supports GUI creation and porting to many system calls.
10. Embedding:You can embed Python into a C/C ++ program, so that users of your program can gain the "scripted" capability.
1.3 Python application scenarios
1.3.1 Web Application Development
Python is often used for Web development. For example, through the mod_wsgi module, Apache can run Web programs written in Python. Gunicorn written in Python can also be used as a Web server to run Web programs written in Python. Python defines the standard WSGI (Web Server Gateway Interface) application Interface to coordinate communication between Http servers and Python-based Web programs. Some Web frameworks, such as Django, Pyramid, TurboGears, Tornado, web2py, Zope, and Flask, allow programmers to easily develop and manage complex Web programs.
Python provides excellent support for various network protocols. Therefore, it is often used to write server software and network worms. The third-party library Twisted supports asynchronous online programming and most standard network protocols (including clients and servers). It also provides a variety of tools and is widely used to write high-performance server software. In addition, the popular third-party library gevent also supports high-performance and high-concurrency network development.
1.3.2 GUI development
The Tkinter library contained in Python can support simple GUI (Graphical User Interface) development. However, more and more Python programmers choose wxPython, PyQt, and other GUI packages to develop cross-platform desktop software. The desktop software developed using them runs fast and matches the user's desktop environment. PyInstaller can also publish programs as independent installation packages.
In many operating systems, Python is a standard system component. Most Linux releases, NetBSD, OpenBSD, and Mac OS X integrate Python and can run Python directly under the terminal. Some released Linux installers are written in the Python language, such as the Ubiquity installer of Ubuntu, the Anaconda installer of Red Hat Linux and Fedora. Gentoo Linux uses Python to compile its Portage package management system. The Python standard library contains multiple libraries that call job system functions. Using the third-party software package pywin32, Python can access the Windows COM Service and other Windows APIs. With IronPython, Python programs can directly call. Net Framework.
1.3.3 others
NumPy, SciPy, and Matplotlib allow Python programmers to write scientific computing programs. Some companies use Scons instead of make to build C ++ programs.
Many Games use C ++ to write graphics, display, and other high-performance modules, while Python or Lua is used to write the game's logic and servers. Compared with Python, Lua features simpler and smaller, while Python supports more features and data types. Many games, such as EVE Online, use Python to process a wide range of logic in the game.
YouTube, Google, Yahoo! NASA uses Python extensively internally. Most of the software for the OLPC job system Sugar Project is written in Python.
Therefore, Python can be applied to data analysis, system programming, component integration, network services, image processing, numerical computing, and scientific computing.