qiuyouzhi 发表于 2020-3-30 21:58:58

Python 查询电话号码所在地

Python 查询电话号码所在地

from requests import get
from bs4 import BeautifulSoup as BS

def open_url(url):
    res = get(url)
    return res

def check(res):
    soup = BS(res.text, "html.parser")
    target = soup.find("title")
    for each in target:
      print(each)

def main():
    phone = input("请输入电话号码:")
    url = 'https://shouji.51240.com/%s__shouji/' % phone
    res = open_url(url)
    check(res)

if __name__ == "__main__":
    main()
页: [1]
查看完整版本: Python 查询电话号码所在地