原创 multiprocessing(2)---communication between subprocesses

ContentsQueueProgramOutputPipeProgramOutput Queue Used among multiple processes. Program from multiprocessing impo

原创 Python Basics---Chapter6 Abstraction (3)

ContentsScoping1. vars()2. The scope of varibles3. globals() and locals()4. Read global varibles inside a function5

原创 crawler(2)

Contents設置代理異常處理Cookies圖片爬蟲實戰re.findall()鏈接爬蟲糗事百科爬蟲 設置代理 from urllib import request def use_proxy(proxy_adrr,url):

原创 machine learning---kNN(1)

Contents創建測試數據集KNN算法過程:KNN 算法實現分類器測試使用k近鄰算法改進約會網站的匹配效果準備數據,從文本文件中構建數據集分析數據:Matplotlib 創建散點圖歸一化數值測試算法:作爲完整程序驗證分類器使用算法:

原创 python basics--裝飾器

contents裝飾器最簡單的裝飾器目標函數帶參數的裝飾器目標函數帶有不固定參數的裝飾器裝飾器帶參數 裝飾器 裝飾器用於動態地爲函數擴展功能,同時不改變原本的函數定義 最簡單的裝飾器 import time def decorat

原创 crawler(1)

Contentshttp get 請求http post 請求 http get 請求 # 利用get請求獲取相應網頁,並以html形式存儲 from urllib import request url='http://www.ba

原创 multiprocessing---communication between subprocesses

ContentsQueueProgramOutputPipeProgramOutput Queue Used among multiple processes. Program from multiprocessing import

原创 Multiprocessing(1)---Pool

ContentsExample 1 The use of multiprocessing.PoolProgramOutputAnnotationAttention Example 1 The use of multiprocessin

原创 python basics(9)--- The Standard Library: A Few Favorites

Contents1. sys(1) sys.argv(2) sys.modules(3) sys.path(4) sys.platform(5) sys.stdin, sys.stdout, sys.stderr2. Heaps3.

原创 Python Basics (7) --- Generators

Contents1. Generators2. yield statement3. A recursive generator4. Generator and iterator 1. Generators Genenrators a

原创 Python Basics---Chapter9 Magic Methods, Properties, and Iterators

Contents1. Preface2. Constructor __ init __3. super function3. Protocol of Python4. The Basic Sequence and Mapping Pr

原创 Python Basics(8)---Modules

Contents1. Modules are programs2. Modules Are Used to Define Things3. Adding Test Code for modules4. Making Your Modu

原创 Python Basics---Chapter8 Exceptions

Contents1. What is an exception?2. The raise statement3. Custom Exception Class4. Catch and handle the exception5. ra

原创 Python Bssics--- Chapter7 MakingYour Own Objects

ContentsThe Magic of Objects1. Polymorphism(1) First example==choice()====count()==(2) Second example==repr()==2. Enc

原创 Python Basics ---Chapter6 Abstraction (2)

contentskeyword Parameters and Defaults1. Positional Parameters2. Keyword Parameters3. Combine the two way of paramet