北京做网站便宜的公司谷歌seo关键词排名优化
在qq的安装目录下找到Tencent\QQIntl\I18N\2052\LocList.xml
,按照xml格式存储,其中国内精确到区县,国外精确到市。若要将其转换成csv:
from lxml import etreexml = etree.parse(r"C:\Users\hmy\Documents\行政区划\LocList.xml")
CountryRegion = xml.xpath('//CountryRegion')
with open(r'C:\Users\hmy\Documents\行政区划\LocList.csv', encoding='utf-8', mode='a')as f:for cr in CountryRegion:cr_name = ''.join((cr.xpath('./@Name') or [''])[0].split())State = cr.xpath('.//State')for s in State:s_name = ''.join((s.xpath('./@Name') or [''])[0].split())City = s.xpath('.//City')for c in City:c_name = ''.join((c.xpath('./@Name') or [''])[0].split())Region = c.xpath('.//Region')if Region:for r in Region:r_name = ''.join((r.xpath('./@Name') or [''])[0].split())f.write(','.join((cr_name, s_name, c_name, r_name)) + '\n')else:f.write(','.join((cr_name, s_name, c_name, '')) + '\n')
要获取英文名,则在国际版qq的安装目录中查找对应的1033目录。