会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
myrj
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
183
184
185
186
187
188
189
下一页
2020年2月16日
python xpath
摘要: //img/@src 得到所有img标签的src值 //a/text() 得到所有A标签中的文本 name=response.xpath('//img@src').getall() #getall()从对象中获取具体值 import requests,re from lxml import etre
阅读全文
posted @ 2020-02-16 16:00 myrj
阅读(239)
评论(1)
推荐(0)
2020年2月14日
python 正则表达式
摘要: r'[\u4e00-\u9fa5]汉字 .匹配除换行符外的任意字符 \d匹配所有数字 ,与[0-9]相同[0123456789] \D匹配非数字字符,[^0-9] \w匹配数字,字母,下划线[0-9a-zA-Z_] \W匹配非数字 字线 下划线[^0-9A-Za-z] \s匹配任意空白符(空格 换行
阅读全文
posted @ 2020-02-14 20:18 myrj
阅读(149)
评论(0)
推荐(0)
python try except
摘要: 执行过程中出错,复制错误信息,利用TRY得到相应的错误,并用特别方法解决: print(3/0)提示: Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> print(3/0)ZeroDivisionE
阅读全文
posted @ 2020-02-14 18:15 myrj
阅读(184)
评论(0)
推荐(0)
PYTHON ITERTOOLS
摘要: import itertools mylist=list(itertools.permutations([1,2,3,4],3)) #排列 print(mylist) print(len(mylist)) mylist=list(itertools.combinations([1,2,3,4],3)
阅读全文
posted @ 2020-02-14 17:41 myrj
阅读(202)
评论(0)
推荐(0)
2020年2月13日
python根据正则表达式生成指定规律的网址
摘要: import os def file_name(file_dir): for root, dirs, files in os.walk(file_dir): print(root) #当前目录路径 print(dirs) #当前路径下所有子目录 print(files) #当前路径下所有非目录子文件
阅读全文
posted @ 2020-02-13 14:47 myrj
阅读(615)
评论(0)
推荐(0)
2020年2月12日
scrapy 403
摘要: https://images.weserv.nl/?url=
阅读全文
posted @ 2020-02-12 21:21 myrj
阅读(118)
评论(0)
推荐(0)
2020年2月11日
python encode decode
摘要: Python encode()encode() 方法以 encoding 指定的编码格式编码字符串。errors参数可以指定不同的错误处理方案。写法:str.encode(encoding='UTF-8',errors='strict')参数encoding -- 要使用的编码,如"UTF-8"。e
阅读全文
posted @ 2020-02-11 21:04 myrj
阅读(257)
评论(0)
推荐(0)
PYTHON startswith (endswith类似)
摘要: Python startswith()方法Python startswith() 方法用于检查字符串是否是以指定子字符串开头,如果是则返回 True,否则返回 False。如果参数 beg 和 end 指定值,则在指定范围内检查 语法:str.startswith(str, beg=0,end=le
阅读全文
posted @ 2020-02-11 20:37 myrj
阅读(264)
评论(0)
推荐(0)
2020年2月10日
PYTHON 利用ImagePipeline专门爬取图片
摘要: 自定义file_path()函数,即可以原有图像文件名为名来保存,并分类保存 def file_path(self, request, response=None, info=None): image_guid = request.url.split('/')[-2]+"/"+request.url
阅读全文
posted @ 2020-02-10 19:51 myrj
阅读(405)
评论(0)
推荐(0)
2020年2月8日
WIN7 WIN10修改path不用重启即可生效
摘要: 近来安装python scrapy经常忘了添加到path,需要时增加了但需要重启才能起作用,用下面的方法马上能生效: 1修改path:右击“计算机”--高级--环境变量--path 2。打开“任务管理器”,结束进程"explorer.exe",再打开.方法:在任务管理器进程中找到“explorer.
阅读全文
posted @ 2020-02-08 20:01 myrj
阅读(1544)
评论(0)
推荐(0)
上一页
1
···
183
184
185
186
187
188
189
下一页
公告