字典练习


[root@Client-1 day1]# vi 1.py

#!/usr/bin/python


info = {}

name = raw_input("please input name: ")

age = raw_input("please input age: ")

gender = raw_input("please input (M/F): ")

info['name'] = name

info['age'] = age

info['gender'] = gender


print info


保存退出


[root@Client-1 day1]# python 1.py

please input name: Make

please input age: 21

please input (M/F): M    

{'gender': 'M', 'age': '21', 'name': 'Make'}