original table of the change.>>> x = [1,2,3,47,3,2,5]>>> X.sort ()>>> x[1, 2, 2, 3, 3, 5, 47]>>>The sort method is highlighted below: Because he modifies the original list of data, I want a sort that does not modify the original list, to a list copy, is sorted well. How does this happen:>>> x = [1,2,3,47,3,2,5]>>> y = x[:]>>> y[1, 2, 3, 47, 3, 2, 5]>>> x[1, 2, 3, 47, 3, 2, 5]>>> Y.sort ()>>> y[1, 2, 2, 3, 3, 5, 47]>>> x[1, 2, 3, 47, 3, 2, 5]>>>It's a bit heavy. Rest summarized under. Continue l
"debugger." A debugger is like doing a full-body scan on a sick person. YouDon't get any specific useful information, and you find a whole lot of information thatDoesn ' t help and is just confusing.2. The best-of-the-to-debug a program is-use print-to-print out the values of variables atPoints in the program to see where they go wrong.3. Make sure parts of the your programs work as your work on them. Do not write massive filesof code before you try to run them. Code a little, run a little, fix
The principle and the previous chapter to get the same, just a change of the content of the analysis.Code:#-*-coding:utf-8-*-import urllib2import redef getpagecontent (page_url,heads): Try:req = Urllib2. Request (page_url,headers=heads) resp = Urllib2.urlopen (req) return Resp.read (). Decode (' UTF8 ') except Exce Ption, E:print "Request [%s] error. "% (Page_url), E return" "Def gettopnotes (cont): Strre = '. *?Output:The secret 4820=== of C:\Python27\python.exe f:/srccode/
#!/usr/bin/env python#coding=utf-8# Phone Book management, you can add, delete, modify, query user information import Cpickle as P class Telephone:def __init__ (self): "Construction Method" Def addpeople (Self,name,email,telephone): "" "Add User" "" Teledict = Self.getdictda Ta () if teledict:infolist = [Name,email,telephone] teledict[name] = infolist Self.writefile (teledict) else:teledict
memory - :p Aram S_strfile: - : return: - """ - #com = re.compile (' in #'. *? - #two rows and one line of effect to #com = re.compile ( + #' - #Re. S) the #above is to build the regular through method compile into an object * $ #try to get it all out by findall, but it takes up a lot of memory, so find the result store, plan to build a generator, take one at a timePanax Notoginseng #page = Com.findall (s_strfile) - #Print (page) the +ret = Patter
Jingdong Book review has a very rich information, which contains the date of purchase, the title, author, Praise, in the evaluation, the difference between the evaluation and so on. Take the purchase date as an example, using Python + MySQL with the implementation of the program is not large, only 100 lines. I have raised the relevant explanations in the program:
From selenium import WebdriverFrom BS4 impo
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.