First, what is a functionA function is a code snippet that can be called, reusable, to implement a single, or related function.Role of the function:
Reduced duplication of code and improved modularity of applications
Keep your code
Summarize1, "function: can be expressed as" multi-line Comment "," multi-line string "," inside the single double quotes do not escape "2, R means: Raw3. R only works on the backslash (note the problem of individual \)What is the use of raw string?
Python Learning note 11-python built-in functionsFirst, look at the Python function description:https://docs.python.org/2/library/Second, Python built-in functions1, ABS get absolute value:View ABS from the Python website
abs(x)
Return
Type of parameter:There are 2 types of parameters for a function:1. function definition is used to receive the form parameter parameters of the value.2. The actual parameter arguments used to pass the value when the function is called.Parameters are
There are several types of data that can be stored in memory, and there are several types of data that can be processed directly in Python:Number (Numbers)Strings (String)Listing (list)Tuple (tuple)Dictionary (Dictionary)Collection (SET)Boolean
I. Producer / consumer modelConcept: The producer generates a piece of data and puts it in buffer , while the consumer pulls and consumes the data from the bufferUnderstanding : Like in the life of manufacturers to produce products, customers buy
"""Job: Let the user enter a user name and password, verify three times, three unsuccessful, lock the last user."""Def login1 ():"" The method of implementing login Verification yourself:According to what has been learned to think of the method. The
3.1 Viewing data item data typesType (name)3.2 View data item data IDID (name)3.3 Object referenceNotes Python saves all data as a Memory objectin Python, a variable is actually a reference to a Memory object Dynamic type: At any point in time, an
Source: http://blog.chinaunix.net/uid-21566578-id-438233.htmlNote The comparison: "Python" argparse moduleLimodouCopyright Limodou ([email protected]) if you want to reprint please keep this information!When you run a program, you may need to enter
BS4 does not have this good, bs4 tree is too complexlxml is good.Very good locationDetailed explanations are in the comments.1 #!/usr/bin/python3.42 #-*-coding:utf-8-*-3 4 fromlxmlImportetree5 Importurllib.request6 7 #the HTML of the destination
Python read-write configuration file in the actual application has a very powerful function, in the actual operation also has a fairly simple operation, the following article is the Python read-write configuration file specific program introduction,
In the development of Katana pipeline, the operation of nodes is very common, the Katana API support Python, so you can use Python to manipulate the properties of the node, the following is the specific wording. Create a Katana node using the Python
Posted in Http://liamchzh.0fees.net/?p=234&i=1An accidental opportunity to find the list in Python very interesting.Look at a piece of code first[PY]Array = [0, 0, 0]Matrix = [Array*3]Print matrix# # [[0,0,0,0,0,0,0,0,0]][/py]This code does not
Python-based files read and write this section
Some methods of files and directories in the OS module
Operation of the file
Operation of the Directory
Some methods of files and directories in the 1.os moduleSome of the ways in
In Python, everything is object.First, the document operation process(1) Open the file, get a file handle (object), assign to an object;(2) operation of the file through a file handle;(3) Close the file.The file object F is created by using the open
Python built-in functions, which can be build-in Functions via Python's help document, can be viewed via commands under terminal interaction>>> dir ("__builtins__") [' __add__ ', ' __class__ ', ' __contains__ ', ' __delattr__ ', ' __dir__ ', ' __doc_
Set, copy in depth, copy in Depth
1. set: Aggregates different elements to form a set. It is also a data type in Python.
Unchangeable data type: Number, string, and tuples variable type: List, Dictionary
Purpose: remove duplicates from the
Determine the webpage encoding method python edition and determine the webpage encoding python
During web development, we often encounter web page capture and analysis, which can be completed in various languages. I like to use python, because
Python file operations,
# The Effects of open () and file () are the same.# O = open('1.txt ', 'R') # Read-only, open the file, cannot write# Print f. readline () # Read a row at a time# Print o. readline () # Read a row at a time# Print f. read () #
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