---恢复内容开始--- # == 比较的是数值 a = 1000 b = 1000 print(a == b) #True # is 比较的是内存地址 >>> a = 1000 >>> b = 1000 >>> print(a ==b) True >>> print(a is b) False # 查看内存地址 >>> a = 1000 >>> b = 1000 >>>…
#瓦登尔湖词频统计: import string path = 'D:/python3/Walden.txt' with open(path,'r',encoding= 'utf-8') as text: words = [raw_word.strip(string.punctuation).lower() for raw_word in text.read().split()] words_index = set(words) counts_dict = {index:words.count(…