本文主要介绍编程访问网络文本的几种方式。

1. 访问网络资源

>>> from urllib import urlopen
>>> url='http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.astype.html'
>>> raw=urlopen(url).read()
>>> type(raw)
<type 'str'>
>>> len(raw)
16429
>>> raw[:75]
'\n\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n  "http://'
View Code

相关文章:

  • 2021-08-19
  • 2022-12-23
  • 2021-12-14
猜你喜欢
  • 2021-12-04
  • 2021-11-16
  • 2021-12-08
  • 2021-12-25
  • 2022-01-01
  • 2021-11-08
  • 2021-04-03
相关资源
相似解决方案