import re
import requests ###导入模块
import csv
data=[]
html=requests.get(“http://money.163.com/”).text
print(html)
re_data=re.findall(’

  • (.*?)
  • ’,html)
    for i in re_data:
    data.append([i[1]])

    with open(‘新闻.csv’,‘a’,encoding=‘utf-8’) as f:
    xingwen=csv.writer(f)
    xingwen.writerows(data)
    print(data)

    爬取的新闻标题展示小部分
    python爬虫爬取新闻标题
    更多it小知识请关注作者

    相关文章:

    • 2021-06-01
    • 2022-01-04
    • 2021-04-24
    • 2021-12-05
    • 2021-05-10
    • 2022-12-23
    • 2021-08-26
    猜你喜欢
    • 2022-12-23
    • 2021-04-11
    • 2022-12-23
    • 2022-12-23
    • 2021-04-15
    • 2021-09-04
    • 2022-12-23
    相关资源
    相似解决方案