自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 crawler(2)

Contents设置代理异常处理Cookies图片爬虫实战re.findall()链接爬虫糗事百科爬虫设置代理from urllib import requestdef use_proxy(proxy_adrr,url): """ this function use a proxy to open a webpage args: proxy_a...

2018-12-30 15:55:27 557

原创 machine learning---kNN(1)

创建测试数据集import numpy as np # import everything from numpyimport operator # operator moduledef createDataSet(): # there are two [] for array group=np.array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1...

2018-12-13 22:37:44 222

原创 python basics--装饰器

contents装饰器最简单的装饰器目标函数带参数的装饰器目标函数带有不固定参数的装饰器装饰器带参数装饰器装饰器用于动态地为函数扩展功能,同时不改变原本的函数定义最简单的装饰器import timedef decorator(fun): def wrapper(): start=time.time() fun() runtime...

2018-12-13 13:22:48 112

原创 crawler(1)

Contentshttp get 请求http post 请求http get 请求# 利用get请求获取相应网页,并以html形式存储from urllib import requesturl='http://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd='keyword='你好'# 利用requ...

2018-12-05 09:05:43 169

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

ContentsQueueProgramOutputPipeProgramOutputQueueUsed among multiple processes.Programfrom multiprocessing import Process, Queueimport os, random, time# define the write functiondef proc_writ...

2018-11-22 22:08:47 122

原创 Multiprocessing(1)---Pool

ContentsExample 1 The use of multiprocessing.PoolProgramOutputAnnotationAttentionExample 1 The use of multiprocessing.PoolProgramfrom multiprocessing import Pool # with first alphebet capitalimpor...

2018-11-22 16:31:46 379

原创 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. Deques1. sys(1) sys.argvsys.argv : it is a list containing the command argument...

2018-11-14 14:35:53 148

原创 Python Basics(8)---Modules

Contents1. Modules are programs2. Modules Are Used to Define Things3. Adding Test Code for modules4. Making Your Modules Available5. Attention on sequence slice6. Packages7. Exploring Modules8. Attent...

2018-11-13 14:53:57 141

原创 Python Basics (7) --- Generators

Contents1. Generators2. yield statement1. GeneratorsGenenrators are any functions that have a yield statement.2. yield statementInside a function, when the program meets the return statement,it...

2018-11-12 16:58:42 133

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

Contents1. Preface2. Constructor __ init __3. super function3. Protocol of Python4. The Basic Sequence and Mapping Protocol5. Example: Creat a Infinite Sequence6. The property function1. PrefaceIn ...

2018-11-10 17:38:12 178

原创 Python Basics---Chapter8 Exceptions

Contents1. What is an exception?2. The raise statement3. Custom Exception Class4. Catch and handle the exception5. raise without arguments6. raise another exception7. Catch more than one exception8. C...

2018-11-07 14:19:19 204

原创 Python Bssics--- Chapter7 MakingYour Own Objects

ContentsThe Magic of Objects1. Polymorphism(1) First example==choice()====count()==(2) Second example==repr()==2. Encapsulation3. InheritanceClassThe Magic of ObjectsIn object-oriented programming...

2018-11-04 16:46:57 204

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

ContentsScoping1. vars()2. The scope of varibles3. globals() and locals()4. Read global varibles inside a function5. Nested ScopeScoping1. vars()vars() : return the scoping dictionary of a varible...

2018-11-03 19:37:32 196

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

“I wanted you to see what real courage is, instead of getting the idea that courage is a man with a gun in his hand. It’s when you know you’re licked before you begin, but you begin anyway and see it...

2018-11-02 16:57:49 203

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

Contents1. An example of programme2. str.split()1. An example of programme#store the full namedef store(data,full_name): # str.split() fnlist=full_name.split() if len(fnlist)==2: ...

2018-10-30 15:19:21 144

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除