The "Path of Python" Foundation (1) Grand ceremony: Hello World Program

Source: Internet
Author: User

0x00 Preface

Believe that any programmer encounter any programming language will be with Thanksgiving heart to complete the first program, the program's name is Hello,world, is also the most famous program!

About the origin of the Hello,world program here I will no longer narrate, of course, want to know the origin, I warmly attached to the address slowly see it! 52673794

Okay, let's get back to the point. Today is the first day of Python. I forgot, many lecturers, and video tutorials all say to write a blog, then write it!

From today onwards, My A9kl formally began to learn the language!

Through the ages, China is very pay attention to etiquette, but also the state of etiquette, before the apprentice will be a three cup of tea, knock three head, of course, I am self-taught I would like to admire the search engine, the blessing of search engine today

I a9kl the official primer python with a thankful heart to write my first program: Hello, World.

0X01 Preparation Environment and introduction One, python2.x-3.x version (any) Ii. Development History of Python
  • In 1989, in order to pass the Christmas holiday, Guido began to write the Python language compiler. The name Python, from Guido's beloved TV show Monty Python's Flying Circus. He hoped that the new language, called Python, would fit his ideals: create a language that is all-powerful, easy to learn, easy to use, and extensible, between C and Shell.
  • 1991, the first Python compiler was born. It is implemented in C language and can call the C language library file. From birth, Python already has: classes, functions, exception handling, core data types including tables and dictionaries, and module-based expansion systems.
  • Granddaddy of Python Web frameworks, Zope 1 is released in 1999
  • Python 1.0-january 1994 adds lambda, map, filter and reduce.
  • Python 2.0-october 16, 2000, added a memory recovery mechanism that forms the basis of the Python language framework Now
  • Python 2.4-november 30, 2004, the same year now the most popular web framework Django was born
  • Python 2.5-september 19, 2006
  • Python 2.6-october 1, 2008
  • Python 2.7-july 3, 2010
  • In November, it is announced that Python 2.7 would is supported until 2020, and reaffirmed that there would is no 2. 8 release as users were expected to move to Python 3.4+ as soon as possible
  • Python 3.0-december 3, 2008
  • Python 3.1-june 27, 2009
  • Python 3.2-february 20, 2011
  • Python 3.3-september 29, 2012
  • Python 3.4-march 16, 2014
  • Python 3.5-september 13, 2015

When we write the Python code, we get a text file that contains the Python code for the .py extension. To run the code, you need the Python interpreter to execute the .py file.

three, a variety of Python interpreter

Since the entire Python language is open source from spec to interpreter, it is theoretically possible for anyone to write a Python interpreter to execute Python code (which is difficult, of course) as long as the level is high enough. In fact, there are a number of Python interpreters.

CPython

When we downloaded and installed Python 2.7 from the official Python website, we immediately got an official version of the interpreter: CPython. This interpreter was developed in C language, so called CPython. Running at the command line python is to start the CPython interpreter.

CPython is the most widely used Python interpreter. All the code for the tutorial is also executed under CPython.

IPython

Ipython is an interactive interpreter based on CPython, meaning that Ipython is only enhanced interactively, but the functionality and CPython of executing Python code are exactly the same. Like many domestic browsers although the appearance of different, but the kernel is actually called ie.

CPython >>> is used as a prompt, while Ipython is used In [ 序号 ]: as a prompt.

PyPy

PyPy is another Python interpreter whose goal is to perform speed. PyPy uses JIT technology to dynamically compile Python code (note that it is not interpreted), so it can significantly improve the execution speed of Python code.

Most python code can run under PyPy, but PyPy and CPython are somewhat different, which results in the same Python code being executed under both interpreters. If your code is to be executed under PyPy, you need to understand the differences between PyPy and CPython.

Jython

Jython is a Python interpreter running on the Java platform that compiles python code directly to Java bytecode execution.

IronPython

IronPython is similar to Jython, except that IronPython is a Python interpreter running on the Microsoft. NET platform that compiles python code directly into. NET bytecode.

When you're done, start installing it!

0x02 Installation

Windows

1 1, download the installation package 2     https://www.python.org/downloads/3 2, install 4     Default installation path: C:\python275 3, configuring environment variable 6     "Right-click Computer"-"Properties"-"Advanced system Settings"- -"Advanced"-"Environment variable"-"in the Second content box find a row of the variable named path, double-click the"- "Python installation directory appended to the variable value, with; split"7     For example: the original value; C:\python27, remember that there's a semicolon in front

Linux

no need to install, original Python environment Ps: if comes with 2. 6, please update to 2.7

0x03 Combat

Create a file called hello.py, and enter

1 Print ("Hello world! ")

In the interactivity, call Python's own interactive runtime code (Ps:python comes with idle "F5")

1Python 3.6.3 (V3.6.3:2c5fed8, Oct 3, 18:11:49) [MSC v.1900 64bit (AMD64)] on Win322Type"Copyright","credits" or "license ()"  forMore information.3>>>4==================== restart:c:\users\91001\desktop\1.py ====================5 Hello world!6>>>

By the way, enclose the Hello world! in other languages

1 #include <stdio.h>2int main (void)3{4 printf ("\nhello world! " ); 5 return 0 ; 6 }78 C
C
1 #include <iostream>2int main (void)3  {4 std::cout<<"HelloWorld"; 5 }
C + +
 1  public  class     helloworld{ 2  //  The entry of the program  3  public   Static  void   main (String args[]) { Span style= "COLOR: #008080" >4  //  output information to the console /span>5  System.out.println ("Hello world!"  6  }  7  }  8   9  JAVA 
JAVA
1 <? PHP   2              Echo "Hello world!" ;   3 ?>  
PHP
1 " Hello World. "  
RUBY
1 <HTML>2 3 <title></title>4 5 <Body>6 7 <DivAlign= "Center">8 9 Hello World!Ten  One </Div> A  - </Body> -  the </HTML>
HTML
1<span style="font-size:18px;">usingSystem;2 3 usingSystem.Collections.Generic;4 5 usingSystem.Linq;6 7 usingSystem.Text;8 9 usingSystem.Threading.Tasks;//The above code is automatically generatedTen  One   A  - namespaceCrazy//declaring namespaces -  the { -  -     classHelloWorld//class name -  +     { -  +         Static voidMain (string[] args)//declaring the Main method A  at   -  -         { -  -Console.WriteLine ("helloworld!");//called the WriteLine () Method of the System.Console class to write data to the standard output stream -  inConsole.ReadLine ();//Pause the program, press ENTER, the program continues to run -  to         } +  -     } the  *}</span>
C #
1 Print ("HelloWorld")
Lua scripting language
1 1.10 Printing Hello World (F #)2  3let"Hello world! "  [1] 4 " %s " message        [2]
F #

0x04 Curtain CallFinish

Python's Path Foundation (1) Grand ceremony: Hello World Program

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.