1. Function definitiondef function name (formal parameter):function Bodyreturn value2. Function Executionfunction name (argument)3, the parameters passed in the parameter by default is the number, in order one by one corresponds, you can also
The theoretical part when importing modules:If you customize a module, the import is likely to be a problem, because the system automatically go back to the Sys.path output of these directories down to find, and the custom module is likely no longer
Closures (closure)When a function internally defines a function, and the internal function applies an external function parameter or a local variable, when the intrinsic function is treated as the return value, the relevant parameters and variables
# function Destroy# Global Function Destruction# redefine function with the same name# del statement Delete function object# at the end of the programdef foo (xyz=[], u= ' abc ', Z=123): Xyz.append (1) return XYZPrint (ID (foo))def foo
One, for loopGrammar:The syntax format for the For loop is as follows:For in sequence: statements(s) Example:Test = ' RIP the paper King 'For my in test: Print (my)Output Result:TearPaperWangGoodSecond, index, subscript, get a character in a
Appearance modeDescriptionThe appearance mode is also called the façade mode. Decoupling is a highly regarded concept in object-oriented programming. But in fact, due to the complexity of some systems, the coupling between the client and the
1. Basic ConceptsHide a property (set to private) in Python, starting with a double underscore#actually this is just a kind of morphing operation#names that begin with all double underscores in a class, such as __x, are automatically formed: _ Class
Title: Divide a circle into a small, n-shaped fan that marks these sectors as three-to-three,..., N. Each sector is now painted with M-color, and each sector is painted in one color, and the adjacent fan color is different, how many different kinds
1. What is Paramiko?The Paramiko module provides the ability to execute commands and upload downloaded files from a Telnet server based on an SSH connection. This is a third-party package that needs to be installed before use.Pip homepage:http://www.
DescriptionEnumerate () is a python built-in function:
For an iterative (iterable)/Ergodic object (such as a list, string), enumerate makes it an index sequence that can be used to obtain both the index and the value
More for counting in a
(69-day instruction for homework) route unnamed groupURL (r ' ^test/([0-9]{4})/([0-9]{2}) ', views.test)
URL is a function, the first parameter writes a regular expression
The route matches from top to bottom, and once the match
The server and the client communicate, can be two computers, one as a server, one as a client. can also be tested on a single computer, IP can be used 127.0.0.1. Or use a virtual machine as one of them. IP can be viewed ipconfig.Importsocket#
Import of Packagesseveral ways to import
Import Package Name1 Import Time 2 time.time ()
Import package name, package name1 Import Time,sys 2 time.time () 3 Sys.path
From Package name Import module name1 from Import Time 2 Time ()
From
Flat Dictionary目标 {‘a‘:{‘b‘;1,‘c‘:2},d:{‘e‘:3,f:{g:4}期望 {‘a.b‘:1,‘a.c‘:2,‘d.e‘:4,‘d.f.g‘:4}dic = {‘a‘:{‘b‘:1,‘c‘:2},‘d‘:{‘e‘:3,‘f‘:{‘g‘:4}}}dic1 = {}def fn(dic:dict,dic1key=‘‘): for k,v in dic.items(): if isinstance(v,dict):
Python commonly used methods are generally built-in functions, or inherited from the method of object, is said to be a tool class method, but I sometimes encounter some problems, some methods can be like a tool to view certain information, more
Name spaceaka Name space, as the name implies is the place to store names, what name? For example, if the variable x=1,1 is stored in memory, where is the name x stored? Namespaces are where the name X and 1 bindings are storedA total of 3
Subsections
Indent
Note
Type
Mathematical operations
Process Control
Data Structure
I. indentPython developers intentionally prevent programs that violate indentation rules from being compiled to force programmers to develop good programming habits.
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