本文共 329 字,大约阅读时间需要 1 分钟。
题目:We have provided a file called emotion_words.txt that contains lines of words that describe emotions. Find the total number of words in the file and assign this value to the variable num_words.
emotion_words = open('emotion_words.txt','r')chars = emotion_words.read()chars = chars.split()num_words = len(chars)print(num_words)
转载地址:http://enrci.baihongyu.com/