List: []dict:{}Tuple: ()ListIn, Max, in, Append,count,extend,index,insert,pop,remove,reverse
Method
Hara Llist
return value
Append
Modify
No
Count
No
Return
The Libnum library is a library of functions for various mathematical operations, including common maths, modular, modular squre roots, primes, factorization, ECC, converting, Stuff and other aspects of the function, the personal feel that combined
# file read, write and exception handling Operations Example # date:2017-07-17file_name = "D:/file_demo.txt" with open (file_name, ' W ') as Write_file_obj: ' Write file ' ' Write_file_obj.write ("hello\n") write_file_obj.write ("world\n") with open
We already know that there are several types of data that can be directly applied to for loops: One is a collection of data types, such as,,, list , and tuple dict set str so on; The class is generator , including the generator and yield the
This series of blog main reference from--Adrian Rosebrock: Practical Python and Opencv:an introductory,example driven guide toimage processing and computer Vi Sion "I. Step configurationInstall the following tools separately1, python2.7.x2, NumPy
1 #examples of ordereddict class use2 #the use of the Ordereddict class is similar to a dictionary, unlike the Ordereddict class that records the order in which key-value pairs are added3 fromCollectionsImportordereddict4 5Hoppys =ordereddict
First, the local substitution of the stringPython string substitution can be implemented in 2 ways:1 is the method of using the string itself.2 replacing a string with a regularHere's an example to experiment with:A = ' Hello word 'I replaced word
OS Module
OS.GETCWD () Gets the current working directory, which is the directory path of the current Python script workOs.chdir ("dirname") changes the current script working directory, equivalent to the shell CDOs.curdir returns the current
Online for multiple versions of the Python-compatible installation of the article gradually increased, are all in practice in the summary of experience. My installation after several repeated experiments or feel one of the more convenient.Some of
code example:# Small application: survey, record the investigator's name and answer, ask whether to continue. # Use the data dictionary, while, input (), title (), and upper (). Responses = {}flag = Truewhile flag: name = input ("\ n Please enter
# unittest Unit Test Import unittestfrom Class_demo import Carclass testcar (unittest. TestCase): ' test car class ' def setUp (self): ' initialize Data ' ' self.car_obj = car (' Audi ', ' A6 ') def Test_set_odometer (self):
Common methods of dictionaries:Define a dictionary:D = {' X ': 1} equivalent (d = {' Key, value '}D = dict (x=1)D =dict ({' X ': 1})Empty:D.clear ()Print (d)Value:Print (d[' x ']) directly from the key valuePrint (D.get (' y ', ' can't find it ')).
Namespace: Where the name is stored, the exact name space is where the name and the value of the variable are bound.One, the name space is divided into:Built-in namespaces: generated when the Python interpreter starts, storing some python built-in
First, the automation test code at the beginning is linear, followed by the development of modular code, so involves the functions and methods of reference.1. The most important differences between functions and methods:When defining a function in a
Take the time to brush up on the Python data structure of Peking University during a tense preparation for the Japanese language. Check the gaps. / divisible >>>divmod (9,5) (1,4)/ plural >>>import Cmath >>> (1+2j) * (1+3j) (-5+5j)>>> (1+4j). Imag4
Sub-class built-in typesafter python2.2, built-in types can be subclass, but there is a note: built-in types do not invoke special methods that are overridden by user-defined classes. What do you mean by this, it's more about the mouth. Let's look
Codingby default, Python 3 source files are encoded in UTF-8 , and all strings are Unicode strings. of course, You can also specify a different encoding for the source file:#-*-coding:cp-1252-*-IdentifierIdentifiers are composed of letters, numbers,
first, the Definition:1. Functions defined inside a function2. Contains a reference to an external domain name word, not a reference to the global role name word then the intrinsic function is called the closure functionX=1def F1 (): x=11111111
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