python
楼边斜月为明
学习记录,出错之处,还望指出
展开
-
Avoiding getting banned(Scrapy)
Avoiding getting banned Some websites implement certain measures to prevent bots from crawling them, with varying degrees of sophistication. Getting around those measures can be difficult and tricky,转载 2017-02-18 16:57:02 · 372 阅读 · 0 评论 -
递归组合都不会了?尼玛
def getCombinationExtraSet(extraList, index, selectExtraSet, oneExtraSet): if (index >= len(extraList)): # selectExtraSet.add(frozenset(oneExtraSet)) return extra = extraL...原创 2019-03-17 00:27:13 · 139 阅读 · 0 评论 -
删除pid开始的进程树(包括根节点)
def killProcessTree(pid): rootProc=psutil.Process(pid) print("childProcess:"+str(rootProc.pid)+" "+str(rootProc.gids())) procs=rootProc.children() for proc in procs: if(len(pr...原创 2019-01-08 14:09:34 · 796 阅读 · 0 评论 -
python re
#encoding=utf-8 import resplit_text_1=',fowejfowjeo.fewf;fwefok'split_text='土方氏 官名 。 《 周礼 》 谓 夏官 司马 所属 有 土方 , 设 上士 五人 , 下士 十人 , 以下 有府 、 史 、 胥徒 等 人员 。 掌土圭 ( 古代 测 日影 、 土地 的 工具 ) 之 法 , 选择 适于 建立 邦国 都原创 2017-09-05 22:29:09 · 243 阅读 · 0 评论 -
python 函数参数
So I have difficulty with the concept of *args and **kwargs.So far I have learned that:#重点:*args = list of arguments -as positional arguments#重点:**kwargs = dictionary - whose keys become separate #重点:原创 2017-04-16 20:47:05 · 264 阅读 · 0 评论 -
python下载文件
import osimport requestsdef download_app(download_url,file_path): flag=False with open(file_path, 'wb') as handle: try: apks = requests.get(download_url, s原创 2017-03-27 22:24:05 · 355 阅读 · 0 评论 -
splash爬虫
# -*- coding: utf-8 -*-import scrapyimport sysfrom scrapy_splash import SplashRequestfrom android.agents import agentsreload(sys)sys.setdefaultencoding('utf-8')class AndroidSpider(BaseSpider):原创 2017-02-26 20:39:31 · 1759 阅读 · 0 评论 -
豌豆荚排行榜爬取(selenium)
from selenium import webdriverfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.common.by import Byimpor原创 2017-02-23 21:39:16 · 587 阅读 · 1 评论 -
python导包
import xx mn是模块的名称,导入模块内的所有。 模块内的东西使用需要加模块名。from mn.items import ApkItemmn文件夹下有items.py文件,items.py 中有ApkItem类。为了单独导入ApkItem from mn.items import ApkItem原创 2016-09-09 18:49:24 · 984 阅读 · 0 评论 -
python的全局变量问题
def change(): global x w.write("zzz") x=x+1 print (x) w.close()if __name__ == "__main__": w=open('test.txt','w') x=5 change()一直不理解为什么change函数里为什么可以读w,是受c语言影响,以为这之后...原创 2019-03-21 14:28:13 · 112 阅读 · 0 评论