随笔分类 -  Python

python
dynamic programming-unique path
摘要:classic dynamic problem, ultimately it's iterative problem, like how to calculate the determinant of matrix. The code below is performed by @someone. 阅读全文

posted @ 2020-03-25 13:41 BruceSue 阅读(131) 评论(0) 推荐(0)

!/usr/bin/env python和!/usr/bin/python的区别
摘要:脚本语言第一行 作用:文件中代码用指定可执行程序运行 #!/usr/bin/Python 执行脚本时,调用/usr/bin下python解释器 #!/usr/bin/env python 在环境设置中寻找python目录 (防止用户没有将python装在默认的/usr/bin路径里) 阅读全文

posted @ 2017-02-07 10:05 BruceSue 阅读(575) 评论(0) 推荐(0)

virtual_login
摘要:from selenium import webdriverimport timedriver = webdriver.Chrome()driver.set_window_position(30, 40)driver.set_window_size(1000,700) driver.get('htt 阅读全文

posted @ 2016-12-29 16:17 BruceSue 阅读(237) 评论(1) 推荐(0)

爬取字段和图片 spider_getModelInformation
摘要:import urllibimport urllib2import re class Spider:def getPage(self,pageIndex): url="http://mm.taobao.com/json/request_top_list.htm?page="+str(pageInde 阅读全文

posted @ 2016-12-08 14:26 BruceSue 阅读(217) 评论(0) 推荐(0)

爬取字段 spider_text
摘要:__author__ = 'sus'import urllibimport urllib2import re def getPage(url): #获取网页 request = urllib2.Request(url) response = urllib2.urlopen(request) page 阅读全文

posted @ 2016-12-07 16:47 BruceSue 阅读(281) 评论(0) 推荐(0)

python_bug
摘要:with open('test.txt','r',encoding='utf8') as f: Exception:'encoding' is an invalid keyword argument for this function Reason:'encoding' is not suitabl 阅读全文

posted @ 2016-12-05 16:35 BruceSue 阅读(238) 评论(0) 推荐(0)

spider_jpg
摘要:__author__ = 'sus' #urllib模块提供了读取Web页面数据的接口import urllib#re模块主要包含了正则表达式import re#定义一个getHtml()函数def getHtml(url): page = urllib.urlopen(url) #urllib.u 阅读全文

posted @ 2016-12-05 16:15 BruceSue 阅读(153) 评论(0) 推荐(0)

导航