installation of requests:PIP Install requestsuse of requests:ImportRequestsurl="http://www.mzitu.com"Response= Requests.get (URL)#GET Requestresponse.encoding="Utf-8" #change its encodingHTML= Response.text#get Web contentbinary__content= Response.
Python writes the principle of shielding foul language in each big chat systemSuddenly think of a video inside the screen is a full of harmony of the * number feel very interesting, and then want to use Python to try to write and read, the results
1, tuples are an ordered set,2, tuples and lists can use indexes, slices to take values.3, after the creation of tuples can not be in situ modification and replacement operations.4. Tuples support nesting, which can include lists, dictionaries, and
Left menuDOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd ">HTML>Head> title>Titletitle> style>. Header{Background-color:Black;Color:Wheat; }. Content{Min-height:50px; }.
Baidu searched the concept of closures: in short, the function of closures is that after the external function is executed and returned, the closing mechanism does not retract the resource occupied by the function, because the execution of the
Ask for 1-100 and:Method One: Use Python's own sum functionL= Range (1,101)Print (sum (L)) #5050Method Two:From functools import reduce #python2可以直接使用reduce, Python3 need to import reduce from FunctoolsL = Range (1,101)def f (x, Y):Return X+ysum =
Introduction to jquery:1. Introduction: Download jquery on the official website will download to 1.x, 2.x, 3.x three series, Silver corner King said 1.x series compatibility, function can also meet.2. Format: In the official website no matter
1. String to remove whitespace, strip (), including spaces, tab, line break" Frank ">>> name.strip ()'Frank'2. Splitting of the string, split ("delimiter"), grouped into a list" Apple, Banbana, Orice ">>> name.split (",") ['Apple' ' Banbana ' '
Basic idea of inserting sort:
Each step inserts a record to be sorted by the size of its key value into the appropriate position in the previously sorted file until all is inserted.
Cases:
arr = [49,38,04,97,76,13,27,49,55,65], from the 2nd
Import Os.pathpath = '/home/vamei/doc/file.txt ' Print (os.path.basename (path)) # The file name that is contained in the query path print ( Os.path.dirname (Path) # The directory contained in the query path info = os.path.split #
Conversion of different time units using a datetime module
From datetime import Timedelta a = Timedelta (days=2, hours=6) B = Timedelta (hours=4.5) C = a + b print (C.D ays) print (c.seconds) print (c.seconds/3600)
Represents a specific
List comprehensions, which is a very, very simple but most commonly used feature in Python.
As you can tell by name, the list generation should return the list type, which will generate the required lists in the simplest and most understandable
Generate two-dimensional code via QRCode
The code for the online tutorials can be used
Simple Rough
Import qrcode img = qrcode.make (' http://lizhiyu.iteye.com/blog/2331662 ') img.save (' test.png ') Add parameter Control Python code import
Python quick way to generate comment documents
Today, we will tell you a simple little detail that you can easily make note of, and you can also check whether the class method reference name we wrote has a duplicate problem. A look at the other
Python2.x encoding and python2.x Encoding
Chinese encoding of python2.x is really a headache. Write down your own python coding and conversion experience.
The default encoding format for windows is gbk.
>>> S = raw_input () # in windows, the
OrderedDict and pythonordereddict
Ordered dictionary-OrderedDict Introduction
Example
An ordered dictionary is similar to a common dictionary, but it records the order in which elements are inserted, while a general dictionary iterates in any order.
Debian solves the Sphinx exception "cocould not import extension sphinx. builders. linkcheck (exception: cannot import name SSLError )".
The following exception occurs when you recently used Sphinx to compile the document:
Extension error:Cocould
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