Python解决FutureWarning: Passing literal html to 'read_html' is deprecated and will be removed in a future version. To read from a literal string, wrap it in a 'StringIO' object.
from io import StringIO try: resp = requests.get(url) # pd.set_option('future.no_silent_downcasting', True) # 不提示函数在未来版本中将被替代的警告 df = pd.read_html(StringIO(resp.text)) # 使用io.StringIO创建一个文本缓冲区,然后从中读取HTML内容
pprint(df) except Exception as e: print(e)