python_scripts
python_scripts copied to clipboard
一些python相关的演示代码
您好,请问一下,目前知乎的验证码变成了倒立汉字,请问应该如何做呢?
把获得的cookies保存到cookies.txt文件里,以便以后使用。 有两行 if __name__ == '__main__': 有一行应该是多余的,删掉了一行。
File "crawler.py", line 35 """ SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xc5 in position 5: invalid continuation byte
关于beautifulsoup3不支持python2,是不是作者写错了。不支持python3吧?
fix bugs in ‘func’ function and improve its performance
``` #给 h1 tag 设置居中属性 body.find('h1')['style'] = "text-align:center;" ``` 这时候要用 ``` body = soup.find(class_="article-intro") #body = soup.find_all(class_="article-intro") #如果用find_all 那后面就要用 html = h[1:-1] 去掐头去尾 去掉 [ 和 ] ```
``` def func(m): if not m.group(3).startswith("http"): rtn = m.group(1) + get_domain(url) + "/" + m.group(2) + m.group(3) #rtn = m.group(1) + domain + m.group(2) + m.group(3) return rtn else: return...
root@raspberrypi:/home/pi/python/crawler_html2pdf/pdf# python3 crawler.py Traceback (most recent call last): File "crawler.py", line 14, in import pdfkit ImportError: No module named 'pdfkit' 这是为啥?
`if not m.group(3).startswith("http"):` 应该是group(2)吧
图片无法下载
爬取我想要的代码时 对于网页里的所有图片 全部都是failed to load