Python learns "one": First meeting

Source: Internet
Author: User
Tags lunix

I. The history and opportunities of Python 1, Past life

Python is an object-oriented, literal translation computer programming language, invented by Dutch Guido van Rossum in 1989 and released in 1991 by the first public release. It is often nicknamed the Glue language, which makes it easy to easily connect a variety of modules (especially C + +) made in other languages.

Modern computer programming languages or technical architectures are mostly from abroad, such as java,c,c# and Python. When you touch them, you will find a very interesting phenomenon, they will be the technology to take a very special name, the name behind it is meaningful. Python was originally translated as Pythons, but it was because the founders were enthusiasts of the Monty Python comedy community. Like Java, the origin of the name of the version is more, such as Coffee said (Java logo is a cup of coffee), Tourism said (Java tourism??? Black face) and so on. They are very interesting in their names.

How do I know such a language? My introductory language is C, the teacher seniors are said to learn C, and then learn other languages will not be afraid of (haha, estimated many people have resonance), the second language is Java, in my study of Java when I have not heard of Python, may be I ignorant. Java, as one of the most powerful programming languages of today, is fascinated by its powerful vitality, but when I learned Java I didn't have the habit of blogging (and maybe I could regain my basic skills later). After learning Java (these days, learning programming language is called familiarity?) Will copy be called Mastery? haha). Will use Java to develop the Web, understand the SSM framework, found that computer technology has gone far in front of my cognition, so I want to engage in machine learning, data analysis, read a lot of books, take the Hadoop environment, very confused, do not know what to do. The occasional discovery of Python, attracted by his unique programming art (which will be slowly shared with you later). Java hundreds of line, Python dozens of line? Wow, that's wonderful, isn't it? Python is used to work with data and to calculate large matrices that's pretty fast, and I think the bottom line is that there are more third-party libraries. In this way, I decided to learn the language.

Look at my nagging so much, I do not know what to say. In short, in a word, concise, fast, efficient, let me like on this programming language!

  C and Python, Java, C # and other major differences:

C Language: The code compiles the machine code, the machine code executes directly on the processor, each instruction controls the CPU to work

Other languages: Code compiles to get bytecode, virtual machines execute bytecode and convert to machine code and then execute on processor

The language of Python and C Python was developed by C.

For use with: Python's class library is complete and concise, if you want to implement the same functionality, Python 10 lines of code can be solved, C may require 100 lines or more.
For speed: Python runs faster than C, forcing it to slow down.

Python and Java, C #, etc.

For use with: Linux original Python, no other languages; The above languages have a very rich class library support
For speed: Python may be slightly slower in speed

2. Seize the opportunity

Python as the current popular technology (machine learning, neural network) preferred language, to seize the opportunity, more than the pressure of the body!

Second, the Python environment

The first step to use is to install the configuration environment.

1. WinDOS Environment

  

1, download    https://www.python.org/downloads    According to the operating system and the number of digits to choose Windows  Executable installer    recommended use Python3.52, install    Open the downloaded EXE file    Select Add Python 3.x to Path (you do not need to configure environment variables, System Auto Configuration) 3, configure environment Variables    "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, use; Split "4, verify    that the console input python-v appears in the    version number is successful, Otherwise, re-operate the third step
2. LUnix Environment (CENTOS7)
I'm using Centos7, and the version comes with a python2.7,lunix system that supports multiple Python versions coexistence 1, wget HTTPS://WWW.PYTHON.ORG/FTP/PYTHON/3.5.1/ PYTHON-3.5.1.TGZ2, TAR-ZXVF python-3.5.1.tgz3, mv Python-3.5.1/usr/local4, Ll/usr/bin | grep python    rm-rf/usr/bin/python5, CD/USR/LOCAL/PYTHON-3.5.1/6, config, compile, install    ./configure    make    make Install    7, delete the old soft link, create a new soft link to the latest pythonrm-rf/usr/bin/pythonln-s/usr/local/bin/python3.5/usr/bin/pythonpython- V8, after installing the latest version of Python, may cause other features in LUnix to be unusable, such as Yum cannot be used, modify the file, change the first line #!/usr/bin/python to #!/usr/bin/python27 other empathy

Third, Hello World

1, LUnix directly through the interpreter to print Hello World

Enter Python directly and the ' >>> ' is entered successfully:

>>>Print('helloworld') input, enter, show Hello World, congratulations on success!

2. Create Python run file under LUnix to print Hello World

Vim hello.py # The following are the contents of the file #  Print('helloworld') Save exit file input Python hello.py or. /hello.py run hello.py file output Hello world

Where #!/usr/bin/env Python is used to quickly execute files, there is this sentence can be directly through the./hello.py to run the file, the method is generally used in LUnix more.

  

3, Windows and LUnix under the same, Windows through the command line to achieve the operation, here no longer repeat.

Summarize

How about a new understanding of the Python language? We opened the world of Python, let's explore and communicate together!

Python learning "One": First meeting

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.