1 #basic logic blocks for exception handling2 #is as follows:3 #Exception refers to all errors that can catch all errors4 #valueerror Indexerror ... It's a subclass of exception.5 #www.cnblogs.com/wupeiqi/articles/5017742.html sums up a number of
ZatanBefore using the requests module climbed the beautiful picture, today with the scrapy framework to achieve it again.(Picture scale is really big point, but Swaiiow already have no love red dust, right when watch haha ha)Item:# -*-coding:utf-8-*-
Use global variables in functions (declared with global):>>> x = 1>>> def change_global (): Global xx = x+1>>> change_global () >>> x2A local variable in a function has the same name as a global variable, and 2 uses the same case (gets the value of
1 #a list of business cards to store2Card_infors = []3 4 5 6 defPrint_menu ():7 #1. Print function Tips8 Print("="*50)9 Print("Business Card Management system")Ten Print("1. Add a new business card") One Print("2. Delete a name")
Import geventdef foo (): print ("Running in foo") Gevent.sleep (2) print ("Explicit context switch to Foo again ") def Bar (): print (" Explicit context to Bar ") gevent.sleep (1) print (" Implicit context switch back to bar ") Def
Practice content: Use two ways to implement dictionary access attribution: Use a class wrapper dictionary so that the dictionary does not use [] to access the element, use the. Dot number to access the element as if it were a property.Mode one:
an int (string_num, n) string_num represents some kind of binary string, and n is the number of binary numbers that are string_num.2, 8, 16 binary to 10: using int () or eval ()10 binary to 2, 8, 16 binary: Using Bin (), Oct (), Hex () or using
Refer to the previous article:Python crawler (i)--watercress informationPython crawler (II.)--the construction of the bean Book Decision TreePython Crawler (iii)--a graphical analysis of the comments and scores of each module of watercress books
Requirements: You can choose to go to each submenu from any level back to the previous layer you can exit the program from any level required new knowledge points: List, dictionaryMenu = {' Beijing ': {' Haidian ': {' Five crossing ': {' Soho ': {},'
The path to learning in Python -2018/6/26
1.ORM Single-table operation delete and modify records>>> ret = Book.objects.filter(title="go").delete()(1, {‘app01.Book‘: 1})>>> Book.objects.filter(price=115).update(price=120)Multiple table operations
Basic installation configuration 1, installing Python 2.7默认安装路径:C:\python273.6 64- 默认安装路径:C:\Users\Jam\AppData\Local\Programs\Python\Python35 bitLinux Yum relies on its own python, in order to prevent errors, the update here is actually to
Size of rental room (area)
Rental Rate (price)
Compare informationCode1 ImportMatplotlib as Mpl2 ImportMatplotlib.pyplot as Plt3 ImportPandas as Pad4 ImportSeaborn as SNS5 ImportNumPy as NP6 7Sns.set_style ('Dark')8KF = Pad.read_
1 ImportRequests2 fromlxmlImportetree3 fromBs4ImportBeautifulSoup4 ImportOS5 fromSeleniumImportWebdriver6 7 8 9 #parse each comic page and download comicsTen defmanhua (URL): One A - browser.get (URL) - the #get the page source of the
C and Python, Java, C #, etc.C Language: C language is directly called the Machine code, machine code is the computer can directly recognize the code, it all the code of the computer can recognizeOther languages: code compiled to get bytecode,
Multiple assignment operations are performed simultaneously:>>> x, y , z = #元组赋值 >>> print (x, y, z) 1 2 3 >>> values = [] #列表赋值 >>> x, Y,z = values>>> print (x, y, z) 1 2 3Swap two variables at once>>> x, y, z = 1,2,3>>> print (x, y, z) 1 2 3>>>
The main contents of this section:1. A simple introduction to the dictionary 2. Dictionary additions and deletions and other operations 3. Nesting of dictionariesI. The dictionary's Simple Introduction Dictionary (dict) is the only type of mapping
The main contents of this section:1. List 2. List of additions and deletions to change 3. Nested 4 of the list. Tuples and tuples are nested 5. RangeI. The list of List 1.1 lists is one of the underlying data types of Python, and other programming
Main contents of this section: 1. The difference between IS and = = 2. Problem with codingThe difference between IS and = = 1. ID () by ID () can we see a variable scale? The value shown in the memory address.s = ' Alex ' Print (ID (s)) # 4326667072
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