01-python Foundation

Source: Internet
Author: User

A few days ago, I think Python simply can't, did not take notes carefully, and then today turned over the next few days to see things, or write down

For python2.7 and Python3, it is recommended to use the Python3 mode programming and then use the python2.7 package to run

1, head

Python file header is generally used to declare, a shell is somewhat similar, of course, Windows useless

#!/usr/bin/env python#encoding=utf-8

2, reserved child

The python reserved word has

>>>Import Keyword>>>keyword.kwlist['False','None','True',' and',' as','assert',' Break','class','Continue','def','del','elif','Else','except','finally',' for',' from','Global','if','Import','inch',' is','Lambda','nonlocal',' not','or','Pass','Raise','return','Try',' while',' with','yield']

3, Python controls the block of code by indenting it, so Python requires strict indentation,

Note that when EditPlus remotely connects to Linux, the TAB key is 8 bytes and there will be pits ...

4, Note:

# Single Comment " "  " "

5, multi-line output

Total = Item_one +         +         item_three

6, data type

The Python data type has

Numeric type: int, float, bool, complex (plural) string type: String collection type: list, sets, dictionary, Tuple

Dict uses a special hash algorithm, so the query speed is almost constant no matter how many keys are.

7, import other modules

Import SYS  from SYS import ARGV  from sys import * # is not recommended for use

01-python Foundation

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.