python 练习11

python 练习11_第1张图片

import pickle
data=[]
with open("ML100k.data","r") as file:
    for line in file:
        data.append([int(item)for item in line.strip('\n').split('\t')])
with open("data.pickle","wb") as file:
    pickle.dump(data,file)

 注:ML100k.data文件可直接百度下载

你可能感兴趣的:(python,算法,机器学习)