1. ListLists are the most commonly used Python data type list of data items that do not need to have the same type to create a list, as long as the comma-separated data items are enclosed in square brackets (1) List method: List.append (obj) adds a
Basic data Type one, integer type (int)32-bit machine, the number of digits of the integer is 32 bits, the value range is -2**31~2**31-1, namely -2147483648~214748364764-bit machine, the number of integers is 64 bits, the value range bit -2**63~2**63
e) list with [] representation in Python, the most basic data structure is sequence (sequence). Each element in the sequence is assigned an ordinal-that is, the position of the element, also known as an index. The first index is 0, the
Python's past and present
What is PythonPython is a multi-purpose programming language, often playing the role of scripting languagepython Popular causesSoftware Quality Increase developer productivity (Python code size is C/java 1/3-1/5)
List1 = [1,2,3,4,5,6,7,8,9,10]List2 = [' A ', ' B ', ' C ', ' d ', ' e ', ' F ']Basic Operations1. Delete the specified elementDel List1[2] deleted 3 in listSupport slices: del List1[1:3] to delete 2 and 3 in the list2. Shard Assignment1Name = List (
Chapter 11th Documents and materials11.1 Open FileThe open function is used for opening the file with the following syntax:Open (Name[,mode[,buffering]])f = open (R '/home/python/somefile.txt ')11.1.1 file ModeR Read modeW Write modeA append modeb
Import RandomWhile True: Code = " For I in range (4): Current = Random.randrange (0,4) If current = = I: temp = Chr (Random.randint (65,90)) Else temp = str (random.randint (0,9)) Code+=temp
Last week, the product gave me a demand, is basically to do a back-end system, management game Competition landing page Data Update, the difficulty is to upload files to the CDN. Now that the experience is recorded, the next time there is a similar
Read keyboard input: Raw_input inputThe Raw_input ([prompt]) function reads a line from the standard input and returns a string (minus the end of the newline character):str = raw_input("Please enter:"); Print "What you have entered is:", str
This section mainly describes the Python operators. To give a simple example 4 +5 = 9 . In the example,4 and 5 are called operands , and "+" is called an operator.The Python language supports the following types of operators:
Arithmetic
Data typeA computer is a machine that can do mathematical calculations as the name implies, so a computer program can handle a variety of values. However, the computer can handle far more than the numerical value, but also can deal with text,
9 Higher order functions(1) the map () function receives two parameters, one is the function, and the other is iterable,map the incoming function to each element of the sequence, and returns the result as a new iterator.list(map(str, [1, 2, 3]))(2)
Knowledge of several nouns:classes (Class): used to describe a collection of objects that have the same properties and methods. It defines the properties and methods that are common to each object in the collection. An object is an instance of a
#!/usr/bin/python#Dictionary#While learning Java, the Language foundation for a long time, and then a variety of APIs, and finally the collection#Key-value pairs, variable#1. Mapping OperationsD= {' Food':'Spam','Quantity': 4,'Color':'Pink'}Print(d['
Python deletes elements from listPaul's classmates had to turn away a few days ago, so how do we remove Paul from the existing list?If Paul's classmates were in the last one, we could delete them using the list pop() method :>>> L = [' Adam ', '
The shaping of PythonDuring the coding process, we often have to deal with some integer numbers, and at most sometimes we can ask for their absolute value, for example:A = 100b =-20Print (a)Print (b.__abs__ ())The problem of type conversion between
Python's Create cell element tupleTuple and list, can contain 0, one and any number of elements.A tuple that contains multiple elements, which we have created earlier.A tuple of 0 elements, which is an empty tuple, is represented directly by ():>>>
PEP8 Python encoding specification (conversion), pep8python
Code orchestration1 indent. The indentation of four spaces (the editor can complete this function). Do not use the Tap, or mix the Tap and space.2. the maximum length of each line is 79.
BlackHATPython study notes,Chapter 2 replacing netcat
At first, I was not very familiar with the following code:
1 def client_sender (buffer): 2... 3 4 while True: 5 len_recv = 1 6 response = "" 7 8 while len_recv: 9 data = client. recv (4096) 10
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