()
return cat_to_id, id_to_cat
:return:
def cat_2_id():
    """

    :return:
    """
    categories = ['体育', '财经', '房产', '家居', '教育', '科技', '时尚', '时政', '游戏', '娱乐']
    cat_to_id = dict(zip(categories, range(len(categories))))
    id_to_cat = dict((v, k) for k, v in cat_to_id.items())

    return cat_to_id, id_to_cat
def cat_2_id ( ) : categories = [ '体育', '财 经 , '房产',  ' 居', '教育' , '科技', '时 尚 , '时政',  ' 戏', '娱乐' ] cat_to_id = dict ( zip ( categories , range ( len ( categories ) ) ) ) id_to_cat = dict ( ( v , k ) for k , v in cat_to_id . items ( ) ) return cat_to_id , id_to_cat