The first python program and the first python Program
Import pickle as p
Linkmanfile = 'linkman. data'
# The name of the file where we will store the object
Linkman = {'hangzhou': '20140901 ',
'Xulisen': '20140901 ',
'Initui': '123 ',
'Yangangkuo': '123 ',
'Lijizhou': '123 ',
'Lifecylong': '20140901'
}
# Set up linkman data base
Print '% d lineman:' % len (linkman)
For name, qq in linkman. items ():
Print '% s: % s' % (name, qq)
# List original listing
Print '(1-search 2-delete 3-add 0-revise )'
# Prompting of operation
K = int (raw_input ('Please input :'))
If k = 1:
S = raw_input ('search the linkman name :')
Print '% s' % linkman [s]
Elif k = 2:
D = raw_input ('delete the linkman name :')
Del linkman [d]
Elif k = 3:
A = raw_input ('add the linkman name :')
A = raw_input ('add the linkman number :')
Linkman [a] =
Elif k = 0:
R = raw_input ('which revise :')
Linkman [r] = raw_input ('vised number :')
# Code of process
For name, qq in linkman. items ():
Print '% s: % s' % (name, qq)
# Print new listing
F = file (linkmanfile, 'w ')
P. dump (linkman, f)
# Put data into a file for using next