前言:
如今朋友们对“小程序动态修改css”大致比较关怀,同学们都想要了解一些“小程序动态修改css”的相关文章。那么小编同时在网络上搜集了一些有关“小程序动态修改css””的相关资讯,希望兄弟们能喜欢,小伙伴们快快来了解一下吧!修改文件,下载大图标
不知道为啥速度很慢,感觉一秒才跑一个文件,继续学习,后面优化
import requestsimport reimport osurl = ';head = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'}response = requests.post(url,headers=head)page_txt = response.textex='<div class="thumb">.*?<img src="(.*?)" alt.*?</div>'img_list = re.findall(ex,page_txt,re.S)imgpath = './img/'if not os.path.exists(imgpath): os.mkdir(imgpath)for img in img_list: img_name = img.split('/')[-1] img_path = imgpath + img_name big_image = ';+img_name.split('-')[0] +'-wallpapers'+'.html' print("bigimage: " + big_image) img_response = requests.post(big_image,headers=head) page_text = img_response.text ex='<div align="center" class="picture_wrapper_details".*?<img src="(.*?)" alt.*?</div>' big_image_list = re.findall(ex,page_text,re.S) for bigimg in big_image_list: if not os.path.exists(img_path): bigimg_response = requests.post(bigimg,headers=head) with open(img_path,'wb') as f: f.write(bigimg_response.content) print(f'save {img_path}') else: print('{img_path} already exists') # print(img_list)
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #小程序动态修改css