あとで

def getLDRWeatherHacks():
    url = 'http://weather.livedoor.com/forecast/webservice/rest/v1'

    parameters['day']  = 'today'
    parameters['city'] = '01'
    postdata = urllib.urlencode(parameters)

    weatherxml = urllib.urlopen(url, postdata).read()

    tree = etree.fromstring(weatherxml)
    wtokens['forecastday'] = [tree.xpath('//forecastday')[0].text]
    wtokens['day']         = [tree.xpath('//day')[0].text]
    wtokens['telop']       = [tree.xpath('//telop')[0].text]
    wtokens['temperature'] = [tree.xpath('//temperature/max/celsius')[0].text, tree.xpath('//temperature/min/celsius')[0].text]
    wtokens['area']        = [tree.xpath('//location@area')[0]]
    wtokens['pref']        = [tree.xpath('//location@pref')[0]]
    wtokens['city']        = [tree.xpath('//location@city')[0]]
    wtokens['title']       = [tree.xpath('//title')[0].text]

    return wtokens

def getLDRWHdict():
    pdict[u'道北'] = {
    'areacode':'1a',
    'citylist':{
    u'稚内':'1',
    u'旭川':'2',
    u'留萌':'3',
    },
    }

    #  ### pref
    pdict[u'道央'] = {
    'areacode':'1b',
    'citylist':{
    u'札幌':'4',
    u'岩見沢':'5',
    u'倶知安':'6',
    },
    }

    #  ### pref
    pdict[u'道東'] = {
    'areacode':'1c',
    'citylist':{
    u'網走':'7',
    u'北見':'8',
    u'紋別':'9',
    u'根室':'10',
    u'釧路':'11',
    u'帯広':'12',
    },
    }

    #  ### pref
    pdict[u'道南'] = {
    'areacode':'1d',
    'citylist':{
    u'室蘭':'13',
    u'浦河':'14',
    u'函館':'15',
    u'江差':'16',
    },
    }

    return pdict


def getforecastpoint(entry):
    weatherdict = getLDRWHdict()
    forecastpoint = {'cityindx':[], 'cityname':[], 'areaname':[], 'areacode':[]}


    for area in weatherdict.keys():
        for city in weatherdict[area]['citylist'].keys():
            if entry.find(city) != -1:
##                forecastpoint['cityindx'] = weatherdict[area]['citylist'][city]
##                forecastpoint['cityname'] = city
##                forecastpoint['areaname'] = area
##                forecastpoint['areacode'] = weatherdict[area]['areacode']
                forecastpoint['cityindx'].append(weatherdict[area]['citylist'][city])
                forecastpoint['cityname'].append(city)
                forecastpoint['areaname'].append(area)
                forecastpoint['areacode'].append(weatherdict[area]['areacode'])

    return forecastpoint

def getforecastday(entry):
    daydict['today']=[u'今日', u'きょう']

    day = 'today'
    indx = [entry.find(x) for x in daydict[day] if entry.find(x) != -1]
    if len(indx):
          daycandidate.append(day)