根据手机号码查询号码归属地,了解Python的爬取资料还是很容易。全部代码如下就可以返回需要的数据了。
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Randy' from bs4 import BeautifulSoup import requests html_doc = requests.get('http://www.ip138.com:8080/search.asp?action=mobile&mobile=13800138000') soup = BeautifulSoup(html_doc.content,'lxml') mark = soup.find_all('td',class_="tdc2") print '手机号码:',mark[0].get_text() print '卡号归属地:',mark[1].get_text()
输出
手机号码: 13800138000 测吉凶(新) 卡号归属地: 北京
requests
Python 最好用的第三方 http 库-Requests.
Requests安装
pip install requests
BeautifulSoup
Python 最好用的第三方分析HTML代码的库。
BeautifulSoup安装
pip install beautifulsoup4
stat -c "%a %n" file , 755, 644
ModuleNotFoundError: No module named 'MySQLdb', ...
Ubuntu18.04下使用pyenv安装python报错:BUILD FAILED (Ubun ...
dell提供了工具远程查看服务器硬件状态,可以修改硬件的参数,可以远程连接过去直接修改,就不需要 ...
启动报undefined symbol: EVP_CIPHER_CTX_cleanup错误。op ...
ubuntu开启crontab日志记录及解决No MTA installed, discardi ...
暂时还没有评论,第一个来评论吧!