The Python program language Quick Start tutorial

Source: Internet
Author: User
Tags amazon cloud services

This article is for the SEO crowd of the Python Program language Introductory tutorial, but also apply to other no program basis but want to learn some programs to solve simple practical application needs of the crowd. In the later will try to use the most basic angle to introduce this language.

I was going to find an introductory tutorial on the Internet, but since Python is rarely the language that programmers learn in their first contact program, it's not much of an online tutorial, or a decision to write it yourself.

If you don't have a program base, you might find this article a bit more covered. In contrast to the teaching speed of C, which is often taught in universities, this article has about four or five hours of content; A video tutorial on a program class on a Web site is roughly equivalent to a two or three-hour content; For a book that turns a program, it's about one hours. Therefore, if there is an in-depth study of the plan, in order to efficiency or recommend reading.

It doesn't matter if you don't understand some of the content in this article for the time being, because they're all the basics that you'll often use, and you'll always encounter them when you actually write your code. There will be about two or three articles on practical code written later, and you can choose to deepen your impression of that knowledge at that time.

But if you feel that the technology is not necessary for SEO and not interested in this article, how do you intend to SEO as a career? If you're going to really do it well, it should be reasonable to take a few Baisi hours from inside to learn some technology in at least tens of thousands of hours of energy.

If you are not able to understand any of the articles that are not clearly stated, be sure to help out. The first time to write a more complete tutorial class, there are inevitable omissions.

Why learn Python

If you decide to learn some technology to help SEO, at least for the programming language in my opinion Python is the first choice.

First, Python getting started relatively simple

If someone in the university curriculum in contact with C language but do not know much about the program, may feel that the program is like C so troublesome, but actually, learned the beauty of the Python code will know the C code is smelly and long. Even if you don't have access to a program at all, Python itself is a good choice for getting started with programs.

Although I have written a program very early, but at that time is the interest, never in-depth, formal contact procedure is to contact SEO after things, about learning a few hours later can write some simple collection procedures, so far as long as can think of the need for technology can not be achieved. So there is no basis for the problem, no matter what the basis is the need to lay their own.

Secondly, Python code is very flexible

To see a very common code example, if you do not have the basis of the program will not understand the code, but it does not matter, look at the number of lines can also be compared to the simplicity of code.

Php:

<?php $list _1 = array $list _2 = array (); foreach $list _1 as Code class= "Variable php" $current       array_push $list _2 $current +1); " print_r ( $list _2 ?>

Python:

1 2 3 list_1 = [1,2] list_2 = [current+1 for current in list_1] print list_2

The 2nd line of Python code, called "List derivation," provides a number of handy language features that make the code very concise.

While flexible grammar is not always a good thing, flexible code writing means that each person's written code is often different in style, which will make the team member's level gap is not conducive to team development. But for small SEO application requirements are generally personal development, at this time the writing efficiency of the code is more important than the team cooperation.

Its three, python use of a wide range

Python is popular in programming languages around 5-10 bits. There are C #, Java, PHP, and so on, but many times not because they are more powerful, but because of the reasons mentioned earlier, their code is relatively inflexible and suitable for team development, so it is more popular.

In general, most Web services that provide APIs provide Python interfaces (such as the Baidu Network union, Amazon Cloud services, etc.), while others that are more powerful than Python have less support, such as the Go language, which is more flexible in code. (Most Web services have API interfaces: C #, PHP, Java, Python, Ruby, Perl, so choose at least one language learning in general)

Python also has a lot of modules, and many of the existing modules mean you can do a lot less. For example, downloading a Web page requires 5-10 lines of code in many languages, and Python takes only two lines:

1 2 import urllib2 print urllib2.urlopen('http://g.cn/').read()

It's also interesting that Google previously limited its in-house use of Python language for development. The reason for this is 2:1, because Python writing is efficient, it was used too much before, and the Python language is slow to execute. But for SEO, it is the most need to focus on the efficiency of writing and generally do not care about implementation efficiency.

So much nonsense, but the interest is often the best motivation to learn, hope no white nonsense.

Installation environment and configuration

Python programs and ordinary programs are slightly different, usually do not have directly under Windows to double-click the operation of the EXE file, although it is not impossible to compile into an EXE but relatively troublesome, the actual use of this operation is rarely.

A python program is a piece of text code that is saved to a file with a suffix named. py. You can run the Py file after your computer has the Python running environment installed. (in fact, many programs are dependent on the operating environment, the most common is the. NET Framework, but this is pre-installed on Windows, generally do not feel it)

For Windows systems that require a running environment, the Linux system typically comes with Python without configuration.

The download link for the Python Runtime environment is: http://python.org/getit/

On this page, usually in the first download link, look for and download: Python 2.7.x windows Installer (Windows binary-does not include source)

It should be noted that the best download is the 2.7.x version (X represents any number, 2.7 is similar to the large version), and Python 3 above the version and the previous version of the larger difference, for beginners do not recommend the use.

Install after downloading, there is no need to pay special attention to the place. Generally installed in the default path, that is, c:python27, do not put it in the directory level is very deep folder, otherwise the running time is more troublesome.

Operating system

As mentioned earlier, Python can operate on Windows and Linux systems, and it also supports more systems such as Macs, and can even write and run Python programs on devices such as the jailbreak iphone.

But because one of the main strengths of Python is the support of its modules, it's easy to do a lot of things with a module. And the configuration of the module in Windows and other systems often some trouble, Linux is often much easier, so after the introductory phase, recommended in the Linux environment for development.

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.