(i) Python initial knowledge and variables

Source: Internet
Author: User

Python First Knowledge

To the old boy Wu Sir article (python2): http://www.cnblogs.com/wupeiqi/articles/5433925.html

Kung Fu Sir Article List (Python2): http://www.cnblogs.com/wupeiqi/articles/5433893.html

CENTOS6 Upgrade Python2 to python3:http://www.cnblogs.com/lyy-totoro/p/5603102.html

Simple notes are as follows:

Features of Python

Can write Web pages, can also write background functions. Low execution efficiency and high development efficiency (compared to Java)

Types of Python

Jpython:java developed Python, run Python code first into Java code, and then execute
Python language implemented on Ironpython:.net and Mono, as in the same way
Javascriptpython:javascript developed Python, the same way of execution
Rubypython: analogy, ibid.
Cpython:cpython is our common Python, which is the most stable and powerful python developed by C.
PyPy: This is Python developed with CPython. Execute the fastest python, but not fully functional and stable

Python execution process

Install Python to OS, write files according to Python rules, hand over files to Python interpreter, read file contents to memory, execute action, get execution result

Variable

  Can only consist of uppercase and lowercase letters, numbers, underscores, but cannot start with a number;

And the following built-in keywords cannot be declared as variables:

[' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' Def ', ' del ', ' elif ', ' Else ', ' except ', ' exec ', ' finally ', ' for ' , ' from ', ' global ', ' if ', ' Import ', ' on ', ' is ', ' lambda ', ' no ', ' or ', ' pass ', ' print ', ' raise ', ' return ', ' try ', ' while ', ' with ', ' yield ']

A simple example:

#!/usr/bin/env python-specified interpreter#-*-coding:utf-8-*-#编码, py2 must be specified, otherwise garbledTime ="20180422"username= Input ('Enter user name:') Password= Input ('Enter Password:')ifUsername = ="Erbiao"  andPassword = ="erbiaopasswd" :Print("Login Successful")    Print(time)

Execution effect

(i) Python first knowledge and variables

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.