检查QQ是否在线(api感觉不准)
import requests from xml.etree import ElementTree qq_str = input('please input the qq that you want check!:') url_str ='http://www.webxml.com.cn//webservices//qqOnlineWebService.asmx//qqCheckOnline?qqCode=%s'%qq_str text_str = requests.get(url_str) text_str.encoding='utf-8' #解析xml格式内容,将字符串转为特殊的对象 node = ElementTree.XML(text_str.text) if node.text == 'Y': print('QQ:{} 在线'.format(qq_str)) else: print('QQ:{} 离线'.format(qq_str))