【python小随笔】字典的替换方法

months = {'JAN' : 1, 'FEB' : 2, 'MAR' : 3, 'APR' : 4, 'MAY' : 5, 'JUN' : 6,
          'JUL' : 7, 'AUG' : 8, 'SEP' : 9, 'OCT': 10, 'NOV': 11, 'DEC' : 12}


def test(x):
    mon = months[x]
    print(mon)



if __name__ == '__main__':
    test("FEB")
原文地址:https://www.cnblogs.com/wanghong1994/p/12862797.html