def ctype(old_type):
type_map = {
"ab1": "AB1112",
"cd2": "CD12321",
"ef3": "EF"
}
return type_map[old_type]
l = {"ab":"ab1","cd":"cd2","ef":"ef3"}
if __name__=='__main__':
print l["ab"]
print ctype(l["ab"])
print ctype(l["cd"])
输出:
ab1
AB1112
CD12321
最后
以上就是热心水池最近收集整理的关于字典映射的全部内容,更多相关字典映射内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复