Exemplo n.º 1
0
#         Print.print_lol(man, fh = out_man)
# #         print(man, file = out_man)
#     with open('other_data.txt','w') as out_other:
#         Print.print_lol(other, fh = out_other)
# #         print(other, file = out_other) 
# except IOError as err:
#     print('file error: ' + str(err))
# with open('man_data.txt') as mdf:
#     print(mdf.readline())
# #     Print.print_lol(man, fh = out_man)
#===============================================================================

try:
    with open('man_data.txt','wb') as out_man,open('other_data','wb') as out_other:
        pickle.dump(man, out_man)
        pickle.dump(other, out_other)
except IOError as err:
    print('File error: ' + str(err))
except pickle.PickleError as perr:
    print('PickleError: ' + str(perr))
    
new_man = []
try:
    with open('man_data.txt', 'rb') as man_file, open('other_data', 'rb') as other_file:
        new_man = pickle.load(man_file)
except IOError as err:
    print('File error: ' + str(err))
except pickle.PickleError as perr:
    print('PickleError: ' + str(perr))
Print.print_lol(new_man)
print(new_man)