python字典练习
Posted Frankiee
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python字典练习相关的知识,希望对你有一定的参考价值。
[[email protected] test1]# vim 4.py //ADD #!/usr/bin/python info = {} name = raw_input("Please input a name: ") age = raw_input("Please input your age: ") gender = raw_input("Please input (M/F): ") info[‘name‘] = name info[‘age‘] = age info[‘gender‘] = gender for k, v in info.items(): print "%s: %s" % (k, v) print ‘main end‘ [[email protected] test1]# python 4.py Please input a name: Mike Please input your age: 30 Please input (M/F): M gender: M age: 30 name: Mike main end
以上是关于python字典练习的主要内容,如果未能解决你的问题,请参考以下文章