import sys
sys.path.append("C:/Users/peter/ud1200/ud120-projects/tools/")
sys.path.append('C:/Users/peter/ud1200/ud120-projects/choose_your_own')
sys.path.append('C:/Users/peter/ud1200/ud120-projects/datasets_questions')
import os
os.chdir('C:/Users/peter/ud1200/ud120-projects/datasets_questions')
import pickle
I tried also this solution
original = "C:/Users/peter/ud1200/ud120-projects/final_project/final_project_dataset.pkl"
destination = "C:/Users/peter/ud1200/ud120-projects/final_projec/final_project_dataset_unix.pkl"
content = ''
outsize = 0
with open(original, 'rb') as infile:
content = infile.read()
with open(destination, 'wb') as output:
for line in content.splitlines():
outsize += len(line) + 1
output.write(line + str.encode('\n'))
print("Done. Saved %s bytes." % (len(content)-outsize))
enron_data = pickle.load(open("C:/Users/peter/ud1200/ud120-projects/final_project/final_project_dataset.pkl", "rb"))
When i used this reference destination file reads there's 81 people in Enron dataset
There's another reference i used This solution
enron_data = pickle.load(open("../final_project/final_project_dataset.pkl", "r"))
print ('Number of people in the Enron dataset: {0}'.format(len(enron_data)))
But this solution produces the TypeError: a bytes-like object is required, not 'str' although the original solution found the right number of mails
print ('Number of people in the Enron dataset: {0}'.format(len(destination)))
Any help!!!