My Python self-learning Path 3: tuples and dictionary learning summary, the path to python
1. tuples
1. the Python tuples are similar to the list, except that the elements of the tuples cannot be modified.
The tuples use parentheses, And the list uses square brackets.
Creating tuples is simple. You only need to add ele
Python 3 Study Notes (5) ---- variables, recursion and high-level functions, python high-level functions
I. Variables
1. the variables defined in the subroutine are called local variables, and the variables defined at the beginning of the program are called global variables.2. The global variable scope is the whole program, and the local variable scope is the sub
Python built-in type (3) -- Comparison, python built-in type
Python has eight comparison operators:,,>,>=,==,!=,is,is notThey have the same priority. Their meanings are as follows:
Operator
Description
Less
Less than or equal
>
Greater
>=
Greater than or
How to use Python to perform simple operations on Excel, which is important for interface automation testingA. Prepare a JSON document in the following format:{"Register": {"mobile": "15500000090"},"Login": {"mobile": "15500000090", "Password": "111111"}}1. You may be confused, this format and normal JSON format a little different, the general JSON string is this {"mobile": "15500000090"}* Written in the above format is mainly to wrap a JSON string, w
Python simple crawler 3. python CrawlerWe will continue to study BeautifulSoup classification Printing Output Python simple Crawler 1 Python simple Crawler 2
The first two sections mainly show how to use BeautifulSoup to capture webpage information and obtain the correspondi
Recently in learning Python, like many beginners, the beginning of a more tangled in the end is version 2 or version 3 is the future trend. In order to avoid too many detours, special online Check the relevant information, summed up some 2 and 3 differences, a lot of content is reproduced, the great God do not despise ha ...
1. Performance
The Py3.0 runs Pystone
Recently in learning Python, like many beginners, the beginning of a more tangled in the end is version 2 or version 3 is the future trend. In order to avoid too many detours, special online Check the relevant information, summed up some 2 and 3 differences, a lot of content is reproduced, the great God do not despise ha ...
1. Performance
The Py3.0 runs Pystone
This article mainly introduces how to use Python arrays. For more information, see 1. Python arrays can be divided into three types:
(1)List common linked listAfter initialization, you can dynamically add elements through specific methods.Definition method: arr = [element]
(2)Tuple fixed arrayOnce defined, the number of elements cannot be changed.Definition method: arr = (element)
(2)Dictionary typeThat is
[Programmer technical skills] Learning a scripting language python (3) dealing with databases, Scripting Language python
Next, the previous article describes how to use python to perform basic CRUD operations on the database. Here, we will describe sqlite3 as an example. Sqlite3 is a very lightweight database. It is ve
Python learning diary 3 variable 2, logical judgment, for loop, python variable
Review the questions that occur when you write a quiz code.
The condition in the While statement. It should be when result = false and answer = input. If answer = input () is written outside the while clause, too small will be output as it was yesterday.
There is also the if statement
1 #meta-ancestor elements cannot be modified, cannot be added and deleted2 #Ganso is also orderly.3Tu = (12,'SF', 27,67,34,7,9,4,3,5,7)4 Print(TU)5 #Ganso can be converted to str,list with each other6 #Ganso can be sliced to iterate over an object7 #the first-level element of Ganso cannot be modified, but it is only a level element8T = ('a','b', ['A','B'])9T[2][0] ='X'TenT[2][1] ='Y' One Print(t) NO 3, Life is short, I learn
Python Summary 3. python Summary
Elegant stringPreface
I remember that I mentioned the character string in the first article of the Python study summary. That is to say hello first, because I didn't mention any string processing methods. Today, I would like to explain in detail how to use strings in
Download and install python2.7.10 and python3.4.3 separately on the official website, then go to Python 2.7.10 's installation directory C:\Python27,Rename Python.exe and Pythonw.exe to Python27.exe and Pythonw27.exe respectivelyThe installation directory for Python 3.4.3 C:\Python34 Python.exe and Pythonw.exe without changes.Confirm that the path C:\Python27 is added to the environment variable path; After
...1.In syntax, the return of a tuple can omit parentheses, and multiple variables can receive a tuple at the same time, assigned to the corresponding value by location,So, the Python function returns a multivalued value that actually returns a tuple, but it's easier to write.2.Defining default parameters Keep in mind that the default parameter must point to the immutable object!3.
; a.sort (reverse=true) >> ;> print a[' s ', ' f ', ' f ', ' d ', ' B ', ' A ', ' s ', ' s ', ' G ', ' f ', ' d ', ' d ', ' d ', ' A ', ' 5 ', ' 5 ', ' 4 ', ' 3 ', ' 3 ', ' 2 ', ' 2 ', ' 2 ' , ' 1 ']10.list[index]=value and Del List[index]List[index]=value: Assigning a value to a specified cursor in a listDel List[index]: Removes the specified cursor value from the list>>> a=list (' abc123456 ') >>> print a
A simple method to implement the type checker in Python 3, python type
Example Function
To develop a type checker, we need a simple function to experiment with it. The euclidean algorithm is a perfect example:
def gcd(a, b): '''Return the greatest common divisor of a and b.''' a = abs(a) b = abs(b) if a
In the preceding example, parameters a, B, and return v
]: Default Start_index and End_index that represent the value of a rule that the entire sequence is divisible by the step in the index
you can do slices with negative numbers. Negative numbers are used at positions beginning at the end of the sequence
S[::-1] can be considered a rollover effect
3, two-dimensional ndarray slices in numpy
For the specific use of one-dimensional data and similar in Python
For
the stack to overflow.Vi. Anonymous functionsAn anonymous function is one that does not require an explicit function to be specified#这段代码def Calc (n): return N**nprint (calc) #换成匿名函数calc = Lambda n:n**nprint (Calc (10))Actual use of the case listres = map (lambda x:x**2,[1,5,7,4,8]) for I in Res: print (i)Output125491664Seven, higher order functionsA variable can point to a function, which can receive a variable, and a function can receive another function as a parameter, a function calle
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.