zoukankan      html  css  js  c++  java
  • python获取script里的内容

    import requests
    from bs4 import BeautifulSoup
    
    url1 = "https://mip.keoaeic.org/journal_skills/6616.html"
    html = requests.get(url1).content
    html=html.decode('utf-8') # python3
    soup = BeautifulSoup(html, "html.parser")
    a = soup.select('script[type="application/ld+json"]') 
    #查找<script[type="application/ld+json"]> 里面的内容,因为这个地址上面有多个相同的,只需要获取对应的下标内容即可。
    
    t = list(a)[0].text
    print(r)
    

      

  • 相关阅读:
    java后端
    2017-12-11
    二叉树与分治法整理
    javaweb
    安装docker
    爬虫
    lintcode
    DEEPlearning
    剑指offer_by牛客网
    DFS
  • 原文地址:https://www.cnblogs.com/todarcy/p/12502838.html
Copyright © 2011-2022 走看看