movies = defaultdict(int)
for line in open('trial.txt', "r"):
user,movie,rating,time = line.rstrip('\n').split('::')
movies[movie] += 1
对于以下行,总是会出现我不明白的错误:
user, movie, rating,time = line.rstrip('\n').split('::')
ValueError: need more than 1 value to unpack
我总是可以打印出这条线,它真的有 4 个部分有什么问题?谢谢你!