标签:python dic
#coding:cp936 __author__ = ‘JYC103‘ num_dic={‘一‘:1,‘二‘:2,‘三‘:3,‘四‘:4,‘五‘:5,‘六‘:6,‘七‘:7,‘八‘:8,‘九‘:9,‘零‘:0} put_num=raw_input(‘输入中文数字:‘) #print put_num for key in num_dic: #print key,num_dic[key] if put_num == key: print put_num,‘对应的阿拉伯数字为:‘,num_dic[key]
结果
C:\Python27\python.exe D:/python_ex/0818/replace_num.py 输入中文数字:二 二 对应的阿拉伯数字为: 2 Process finished with exit code 0
本文出自 “always_yunwei” 博客,请务必保留此出处http://alwaysyunwei.blog.51cto.com/3224143/1541651
标签:python dic
原文地址:http://alwaysyunwei.blog.51cto.com/3224143/1541651