写一个开始方法就行了
Topic source这样好像好点
class WeatherSaxHandler(object):
def start_element(self, name, attrs):
if name.endswith('location'):
d['city'] = attrs['city']
d['country'] = attrs['country']
if name.endswith('forecast'):
if not 'today' in d:
d['today'] = {'text': attrs['text'],'low': attrs['low'],'high': attrs['high']}
elif not 'tomorrow' in d:
d['tomorrow'] = {'text': attrs['text'],'low': attrs['low'],'high': attrs['high']}
- 1
抑郁胖子