Web Crawling

时间:2021-06-08 23:04:07   收藏:0   阅读:0
URL: https://www.sheffield.ac.uk/FRAX/tool.aspx?country=2

country=2代表中国
F12打开开发者模式
Network——XHR
Headers是浏览器向服务器发送的消息

python第一行加上

# -*- coding: utf-8 -*-

Python文件中可以加入main函数用于测试程序

def main():
    print("hello")
    
if __name__ == "__main__":  #当程序执行时
    #调用函数
    main()

python函数定义

def add(a,b):
  return a+b

print(add(2,3))

模块安装及引入

pip install bs4
import bs4
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!