dump data to pickle python

Solutions on MaxInterview for dump data to pickle python by the best coders in the world

showing results for - "dump data to pickle python"
Leonardo
15 Sep 2018
1
2import pickle
3
4# take user input to take the amount of data
5number_of_data = int(input('Enter the number of data : '))
6data = []
7
8# take input of the data
9for i in range(number_of_data):
10    raw = input('Enter data '+str(i)+' : ')
11    data.append(raw)
12
13# open a file, where you ant to store the data
14file = open('important', 'wb')
15
16# dump information to that file
17pickle.dump(data, file)
18
19# close the file
20file.close()
21
22