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

2021-01-25 04:13

阅读:420

标签:oct   print   mon   sep   style   div   may   main   __name__   

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")

 

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

标签:oct   print   mon   sep   style   div   may   main   __name__   

原文地址:https://www.cnblogs.com/wanghong1994/p/12862797.html


评论


亲,登录后才可以留言!