Python start Tour "Hello World"

Source: Internet
Author: User

Python Punch the first day:

What Python is, I believe a lot of online search, here I do not introduce. Here is my study record:

learn a programming language, first of all to understand the history of the development of the language, and then began to use this program language to export the Divine Declaration "Helloworld!" ”。 Just like an oath, you begin to learn the language of the program. Think of it as your faith, to persevere in your study. Whatever the purpose of your study of the language? (like, earn money, learn a knowledge), start your python journey!!!

I only use python3.0 knowledge. the difference between Python3.0 and 2.0 You can find Baidu,python2.7 is 2.0 to the 3.0 transitional version of the. If you want to learn python , it is recommended to learn 3.0 , learn new not to learn old.

If you are using windows to learn python, download it directly from https://www.python.org/downloads/ python APP installs

Pycharm Tools Download:

Https://www.jetbrains.com/zh/pycharm/specials/pycharm/pycharm.html

If you do not buy books, you can also visit the http://www.runoob.com/python3/python3-tutorial.html Novice Tutorial contains python/java/ C + + and other programming languages of the learning materials site.

Python is not much different from Windows or linux . Personally like

Below to get to the chase:

can open CMD input python-v View current version

650) this.width=650; "title=" 1.png "style=" Float:none; "alt=" 1315672de43737e1eeecd7902a15683c.png-wh_ "src=" https:/ /s2.51cto.com/oss/201710/29/1315672de43737e1eeecd7902a15683c.png-wh_500x0-wm_3-wmp_4-s_2761094110.png "/>

or directly into the compilation environment, you can also see, quit using exit().

650) this.width=650; "title=" 2.png "style=" Float:none; "alt=" 4efbc7d47b055d342b0fc34198d2fccc.png-wh_ "src=" https:/ /s5.51cto.com/oss/201710/29/4efbc7d47b055d342b0fc34198d2fccc.png-wh_500x0-wm_3-wmp_4-s_3455091827.png "/>

Declaration of Procedure: Hello World!

#!/usr/bin/python3/* Declaration interpreter, here is dead, if the/user/bin/directory does not have PYTHON3 interpreter, the execution program will be error */#!/usr/bin/env python3/* Use ENV environment variable to find Python , this is generally used.  */(1) Python (' Hello world! ') /*python is so simple, printed out Hello world, is not feeling the declaration is too simple, in fact, this is only your first step in the Long March, not because distance is far, and in and adhere to, adhere to your victory further. */(2) >>>hello world!


650) this.width=650; "title=" 3.png "style=" Float:none; "alt=" C02ae874c76b0fff249d87cd93fe6973.png-wh_ "src=" https:/ /s5.51cto.com/oss/201710/29/c02ae874c76b0fff249d87cd93fe6973.png-wh_500x0-wm_3-wmp_4-s_616728849.png "/>

  1. Note: Pycharm tools can not need you to write a statement, but the proposal or write, develop habits, give a person a professional sense of birth.

  2. Note: the python symbol, single quotation mark ( "') with double quotation marks ( "") has no difference in its role( " " " "the three quotes, which have the function of bulk annotations, do not use the # number to go to a line of comments. You only need to add three quotes at the beginning and the end. The other function of the three quotation marks is to print multiple lines, read literally or difficult to understand, but with the operation of the estimate will be able to understand all of a sudden, as follows:

    650) this.width=650; "title=" 4.png "style=" Float:none; "alt=" 6d377aec11826190bafa1555eea8037f.png-wh_ "src=" https:/ /s5.51cto.com/oss/201710/29/6d377aec11826190bafa1555eea8037f.png-wh_500x0-wm_3-wmp_4-s_4009822194.png "/>

    Coding

    by default, Python3 source files are encoded in UTF-8 , all string encodings are Unicode strings , and you can specify different encodings.

    #-*-Coding:utf-8-*-

    Identifier:

  1. The first character must be a letter or an underscore in the alphabet

    B. other parts of the identifier are made up of characters, underscores, or numbers

    C. identifiers are case sensitive

    Python reserved word

    reserved words are non-keywords, and we cannot use them as identifier names. Python Standard library keyword module, you can output all the keywords of the current version:

Import keywordh=keyword.kwlistprint (h) [' False ', ' None ', ' True ', ' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' de  F ', ' del ', ' elif ', ' Else ', ' except ', ' finally ', ' for ', ' from ', ' global ', ' if ', ' Import ', ' on ', ' is ', ' lambda ', ' nonlocal ', ' Not ', ' or ', ' Pass ', ' raise ', ' return ', ' Try ', ' when ', ' with ', ' yield ']


Line and indent

Python uses indentation to represent a block of code, without using curly braces {}.

The indented spaces are mutable, but the statement of the same block of code must contain the same number of indentation spaces, or an error will be entered.

Multi-line statements

Python When a statement is too long you can use backslashes to implement multiple lines of statements.

Data type

points: integers (int), long integers (bool), points (float), plural (complex)

Print output

Print default newline output, if you want to implement the variable does not wrap, you can add (end=") after

A = ' 1 ' b = ' 2 ' Print (a) print (b) print (a,end= "") Print (b,end= "") print ()

650) this.width=650; "title=" 5.png "style=" Float:none; "alt=" F8a6d6cd9556ce1964813e34fb45bc28.png-wh_ "src=" https:/ /s4.51cto.com/oss/201710/29/f8a6d6cd9556ce1964813e34fb45bc28.png-wh_500x0-wm_3-wmp_4-s_3139442758.png "/>


This article is from the "NJ Niche" blog, please be sure to keep this source http://000011211684.blog.51cto.com/9853378/1977112

Python start Tour "Hello World"

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.