Python学习笔记
Python学习笔记
status
Published
date
Feb 19, 2021
slug
python
summary
Python学习笔记
category
学习思考
tags
Python
replace使用
words = words.replace('被替换词', '替换词').replace('被替换词', '替换词')
快速爬取网页上的table
pip install pandas

import pandas as pd
import requests

url = "网站地址"
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"}
res = requests.get(url,headers=headers)
res.encoding = "utf-8"
tables = pd.read_html(res.text) #直接获取网页可能会403故使用requests先获取HTML代码
print(tables)
 
  • Author:Sky
  • URL:https://zdl.im/article/python
  • Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
  • Python
  • 模拟器单窗口单IP软件使用教程近期在看的一些剧集
    Catalog