I knew Python early, but didn't insist on learning. Recent whim, but can make up for this regret.Object several important concepts:Polymorphic: The same operation can be used for objects of different classes;Encapsulation: Working details of hidden
One, Python open file#=====================python file opening mode open () =====================#Open (Filename,type) type= "R" opens the file as read-only, the file must existFile_r=open ("E:\\python\\hello.txt","R");#Open (Filename,type) type= "W"
1, the basic situation of the dictionary is key:value, such a key-value pair mode, and the dictionary can store the amount of information is almost unrestricted. The corresponding value is obtained by accessing the key. Use between keys and values (:
Type of parameter:There are 2 types of parameters for a function:1. function definition is used to receive the form parameter parameters of the value.2. The actual parameter arguments used to pass the value when the function is called.Parameters are
Open FileThe default is open in R, read-only mode>>> f = open ("/test/demo.txt") for in F: ... Print line, #后面加一个逗号, removed the original default added \ n, less empty lines. . .. hellopythonWrite a file"W": Open the file in writing and write
Mapmap (function, sequence)map()The function receives two arguments, one is the function, the other is to function the Iterable map incoming function to each element of the sequence sequentially, and returns the result as a new one Iterator .map()As
Variable parameters (* *)Say A *, if the last parameter of the function is prefixed with a * *:All other keyword parameters other than the normal parameters are placed in a dictionary and passed to the function.Have a good understanding of * and * *
Start learning Python seriously today.1.list typeList is a Python data type, which is an ordered list of elements that can be added and removed at any time.1.1 Features of the list type
The type of members within a list type can be the same
"""Job: Let the user enter a user name and password, verify three times, three unsuccessful, lock the last user."""Def login1 ():"" The method of implementing login Verification yourself:According to what has been learned to think of the method. The
Do a few questions and review Python's built-in functions.
Pythonround () functionfunction DescriptionThe round () function returns the rounding value of the floating-point number XGrammarRound (x[, N]) Usage Example : floating-point number x=3
Source: http://blog.chinaunix.net/uid-21566578-id-438233.htmlNote The comparison: "Python" argparse moduleLimodouCopyright Limodou ([email protected]) if you want to reprint please keep this information!When you run a program, you may need to enter
List definition>>> a=[' Free','1998']>>>type (a)'List'>>>> BOOL (a)#true if the list has a valueTrue>>>Printa[' Free','1998']>>>Indexes and slices >>> a=[ " hello , " world , ' 2006 ' ' >>> a[1 ' ' world ' >>> a[1:2][ " world " >>
Producer Consumer: Bun shop keeps making steamed buns, pedestrians keep buying---> so to achieve the purpose---> Bun salesTwo different characters Bun shop, pedestrians only responsible for a single operation to make the bun into a connected medium.1
Python Django WBE Framework TutorialFirst, IntroductionDjango provides modules that are often used in development sites, and common code is written for you, and Django allows you to focus on interesting and critical things in web
1. Python installation//Check to see if there is a Python package, and if not, use Yum or go to Python's website to install it[Email protected] ~]# rpm-qa|grep Pythonpython-2.6.6-Wuyi. El6.i686python-iniparse-0.3.1-2.1. El6.noarchpython-urlgrabber-3.
Python's web framework:DjangoOne. DjangoDjango is an excellent next-generation web framework Django's processing flow 1. python:https://www.python.org/downloads/django:https://www.djangoproject.com/download/Note: Before
A: The nature of the Web framework, for all Web applications, is essentially a socket server, the User's browser is actually a socket Client. 1.1:python implementation:#!/usr/bin/env python#coding:utf-8import socketdef handle_request (client):
Since Python 3 is now stable, it is a future version. The new scholar can learn directly from python3. But there are still many enterprise applications that use Python 2 and may have to be maintained. so, We can install Python multi-version in local
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