Recently, many of my friends asked me how to start learning python. Did I receive a training course? Next we will briefly introduce python. Python is an object-oriented, literal-translation computer programming language. It was invented by guidovanrosum at the end of 1989. The first public release was released in 1991. Pytho recently has many friends who asked how to start learning python. Did you submit a training course? Next we will briefly introduce python.
Python is an object-oriented, literal-translated computer programming language. It was invented by Guido van Rossum at the end of 1989 and released in 1991 as the first public release. The Python syntax is simple and clear, and has rich and powerful class libraries. It is often called the glue language. It can easily connect various modules made in other languages (especially C/C ++. A common application scenario is to use python to quickly generate a prototype of a program (sometimes even the final interface of the Program) and then have a special requirement on it, rewrite with a more appropriate language. For example, if the graphics rendering module in 3D games requires a high speed, it can be rewritten with C ++.
Python adheres to a clear and uniform style in design, which makes Python easy to read, maintain, and portability. It can be run on linux, windows, apple, and other operating systems, languages that are popular and widely used by a large number of users. The author of Python intentionally designs highly restrictive syntax, so that bad programming habits (for example, the next line of the if statement is not indented to the right) cannot be compiled. One of the most important items is the indentation rule of Python.
According to my experience, learning any kind of technology and reporting training courses are all nonsense (except for technologies with hardware requirements, such as CCIE, which requires a hardware equipment environment, I usually don't have that stuff). It's a waste of money, and it's almost a foundation after I finish learning it. So why don't I learn it myself? The fastest and most practical method is to read chapter 1-10 of "python concise tutorial" and add the actual practice. It will soon take you to learn any technology. With the in-depth development of the technology, you will eventually be alone, therefore, it is very important to learn by yourself.
Why? Chapter 1-10 of the python concise tutorial introduces python syntax, control flow, operators and expressions, functions, lists, tuples, dictionaries, and some modules. These are basically the basis of programming, however, you have to watch and practice while reading it. You don't have to watch it carefully. You just need to understand and use it. You can write a small script after reading the first 10 chapters, the real learning is that when I write my own application scripts or programs, I will definitely find something I don't understand when I write them. Then I will go to the Internet to check the materials. If you don't know what to do, you 'd better check the information and solve it by yourself. It's so impressive that you don't understand how to find someone with better technology. At the beginning, you may need 20 lines of code to implement a function. With the accumulation of knowledge, you will continue to improve the script, it is possible that you only need 10 lines or less to rewrite this function for a while.
What I learned most about python is to write some O & M scripts, which are often repetitive. In this way, I write some scripts and execute them automatically, reducing the workload, it improves efficiency, ensures the reliability of work, avoids manual misoperations, and learns things. Why not?
Briefly speaking, the basic format of the python script. Below is a python script that prints hello word, which can reflect the format of the python script. I hope you can refer to this format when learning, develop good scripting habits.
#! /Usr/bin/env python
#-*-Coding: UTF-8 -*-
Import OS, sys, datetime, time, MySQLdb
Def main ():
Print "hello word"
If _ name __= = "_ main __":
Main ()
Briefly describe the functions of each part:
#-*-Coding: UTF-8-*-this is the script encoding, not to mention.
Import OS, sys, datetime, time, MySQLdb this is the python module used to import your script.
Def main (): defines a function.
If _ name __= = "_ main _": This statement is optional if it is a script, but we recommend that you use it. For example, if you write some programs, they all exist in a separate py file. One day you suddenly want to use 1. A written function in The py file to process the objects in the current file. You can copy them, you can also add if _ name _ = "_ main _" to the file, then import 1 from the file you are writing to use 1. in py.
Learning is a kind of painful and happy thing. The above are some of my suggestions and learning experience. If you do not write well, don't make a decision. Finally, I sent out an old saying: Shushan has a path of diligence, and the study of the sea has nothing to worry about.
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