import requests from xml.etree import ElementTree as ET r = requests.get(‘http://www.webxml.com.cn//webservices/qqOnlineWebService.asmx/qqCheckOnline?qqCode=577800103‘) re = r.text r1 = ET.XML(re) print(r1.text)
简单检查qq在线
xml 之 tag attrilb text运用
from xml.etree import ElementTree as ET r = ET.XML(open(‘1.xml‘,‘r‘,encoding=‘utf-8‘).read()) print(r.tag) for rt in r: print(rt.tag,rt.attrib,rt.find(‘year‘).text)
时间: 2024-11-05 00:12:32