Basic Python Learning-notes

Source: Internet
Author: User

1.python2 is the legacy, Python3 is now and official (so it is best to use the Python3 version) to enter the Python interpreter under 2.window, you need to configure the environment variable 3. Perform first line plus on Linux#!/usr/bin python (python in the default Usr/bin directory does not change after you have installed it)#!/usr/bin/env python (env indicates that the system is installed by default, self-loading default upgradeable)4. Create the default title display value (set in Editor-file and Code templates)#!/usr/bin/env python#-*-Coding:utf-8-*-# Auther:summer 5. Note The Python encoding specification, which is viewed in PEP86. Variable/character encodingthe use of variables: Store things, easy to callA variable can be any combination of letters, numbers, or underscoresthe first character of a variable cannot be a numberThe following keywords cannot be declared as variable names
[' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' Def ', ' del ', ' elif ', ' Else ', ' except ', ' exec ', ' finally ', ' for ', ' F ' Rom ', ' Global ', ' if ', ' import ', ' in ', ' was ', ' lambda ', ' not ', ' or ', ' pass ', ' print ', ' raise ', ' return ', ' try ', ' while ', ' WI Th ', ' yield ']
variable conventions commonly known as definitions: Write variable names must have meaning: Eg:name,agelong gf_of_oldboy expression of old boy's girlfriend7. Variables, constants:Constants in Python are generally capitalized by default: Eg:pie but can also change 8. Binary: Use a very small number to represent a large number of data Unicode unified Code, universal code ASCII accounted for 8-bit 8byte--> 1980 gb2312 support more than 7,000 Chinese characters--1995 GBK1.0 2w+--GB18030 27w+ --Unicode 2bytes-Utf-8 en:1byte, Zh:3bytesunicode accounts for 16 of 9. Note: When line comment: # commented content Multiline Comment: "" "is commented Content" "" 10. Printing data type print (type (variable name)) Python2 inside the raw_input and python3 inside the input function consistent 11. Enter password ciphertext: (Pycharm inside Not so, Linux inside can ciphertext) import getpasspwd = Getpass.getpass ("Please enter password:") 12. In a python program: = = equals = represents assignment 13,indentationerror error: Indentation errors 14. Loop continue out of this loop, go to the next loop break jump out of the current loop my Python blog address:http://www.cnblogs.com/summerxye/

Basic Python Learning-notes

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.