- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 python将远端图片保存到本地(笔记)
import requestsimport os.pathimg_url="images/upload/image/0_25-TINTO-1.jpg"picUrl = 'http://www.baidu.com/'+img_url# 获取图片内容res = requests.get(picUrl).content# 获取图片路径目录getPicDir = os.path.dirname(img_url)if os.path.exists(img_url):continu...
2022-05-08 16:01:44
544
原创 scrapy取值方式
sel = Selector(text=a.text)xpath:1获取属性值:tags = sel.xpath('//div[contains(@class,"goodsItem")]/a/img/@src|//div[@class="goodsItem"]/a/@href').extract()2获取文本值:tags = sel.xpath("//div[@class='goodsItem']/font/text()").extract()CSS选择器:1获取属性值:
2022-04-17 07:53:55
1155
原创 关于mysql5.7版本以上group by 报错的问题说明(不改mysql配置)
当我在本地环境测试的时候(mysql5.6)结果如下图:SELECT mid,MAX(historyid) historyid,MAX(createtime) max_create_time,MIN(createtime) as min_createtime,createtime FROM history GROUP BY mid ORDER BY historyid DESC limit 0...
2019-01-18 18:47:26
1013
原创 PHP替换字符串的几种方式
1). preg_match:正则匹配,返回:后面的字符串$defaultpic="http://www.baidu.com";preg_match("/[^:]+$/", $defaultpic, $matches);$default_https='https:'.$matches[0];$matches的运行结果为:[0=>'//www.baidu.com']2)...
2019-01-16 10:47:46
1509
原创 PHP创建或追加json格式日志文件
//需求:访问的日志根据小时创建$date_name=date("YmdH",time()); //日志文件路径+名称,使用相对路径$filename="../log/".'access_'.$date_name.'.json';//获取写入日志的参数$param=[ 'access_ip' =>$_SERVER['REMOTE_ADDR'], 'acces...
2018-10-25 14:35:40
1092
原创 小程序上传多张图片并返回图片路径
如果有错误,欢迎指正上传多张图片,获取图片路径地址 data:图片数组 callback:回调function upload_arr(data, callback) { var that = this, i = 0, strimg = [],j=0; //当前上传的哪张图片 for(var i in data){ wx.uploadFile({ url: app.global...
2018-03-20 17:37:17
4535
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人