Discover learn python 3 hard way review, include the articles, news, trends, analysis and practical advice about learn python 3 hard way review on alibabacloud.com
Python 3 easy way to read and write files!A = open (' Test.txt ', ' W ')This line of code creates a text document named Test, the pattern is write (the pattern is divided into three types, W stands for writing, R is for reading, and a for the tail line is added).A.write (' hello,world! ')This line of code is to write data to the Test.txt file, which is written in
Recently learning Python in the system is based on a set of Python3 courses Mooc above. This paper mainly summarizes the key points of the basic part.
1.python Basic data types
2.python operator
3. Build a simple and efficient IDE environment
4. Packages, modules, classes, functions, variables
1.
to small), bool type, default value Falsereturn: NoneDescription of the sort function:Entry: The elements in the list, filled in, followed by only one element at a time, so the function must be allowed to only fill in one parameterReturn: Sort by the elements of a number, string equivalent type, sort arranges the newly created elements again, arranges the original elements of their mapping, and if multiple values are returned, the first return value is the highest priority, the second is the se
, in which case a sequence of tuples is generated with the elements in the sequence parameter. Here's an example of using the map () function:Def Add_one (a): return a + 1def add_two (A, B): return a + bdef add_three (A, B, c): return a + b + ca = [1, 2, 3, 4, 5]b = [1, 2, 3, 4, 5]c = [1, 2, 3, 4, 5]result = Map (Add_one, a) print Resultresult = Map (Add
that can receive a key function to implement a custom sort, sort the keys, and then display the corresponding value sort results.A reverse sort can pass in the third parameter reverse = True.return function: function can return a result of a calculation, or return a function, return a function, this function is not executed, so it is best not to refer to variables that may changeanonymous function: Lambda x:x*x where x is the parameter of the function, the result of the expression of the anonym
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.