- Joined
- Mar 31, 2020
- Messages
- 1
- Reaction score
- 0
# python3.7.2
#so i wrote the contents of frequent dictionary to the file common_f
frequent ={'1':'11111','2':'222222','3':'33333','4':'44444'}
file = open('F:\\common_f','w')
file.write((frequent))
print((frequent))
file.close()
print('exit to system')
exit()
#then when i retrieve, i get a single line as follows
#{'1':'11111','2':'222222','3':'33333','4':'44444'},
# not 4 dictionary entries :
frequent={}
file = open('F:\\common_f','r')
frequent=file.read()
print(frequent)
file.close()
what am i doing wrong?
#so i wrote the contents of frequent dictionary to the file common_f
frequent ={'1':'11111','2':'222222','3':'33333','4':'44444'}
file = open('F:\\common_f','w')
file.write((frequent))
print((frequent))
file.close()
print('exit to system')
exit()
#then when i retrieve, i get a single line as follows
#{'1':'11111','2':'222222','3':'33333','4':'44444'},
# not 4 dictionary entries :
frequent={}
file = open('F:\\common_f','r')
frequent=file.read()
print(frequent)
file.close()
what am i doing wrong?