#打开并读取文件
file=open(r'c:\Users\Administrator\Desktop\Walden.txt','r')
lines=file.readlines()
#要把每行拆成单词
words=[]
for line in lines:
tmp_list =line.split(" ")
for word in tmp_list:
words.append(word)
words
['\n',
'Walden\n',
'\n',
'Contents\n',
'WALDEN\n',
'1.',
'Economy\n',
'2.',
'Where',
'I',
'Lived,',
'and',
'What',
'I',
'Lived',
'For\n',
'3.',
'Reading\n',
'4.',
'Sounds\n',
'5.',
'Solitude\n',
'6.',
'Visitors\n',
'7.',
'The',
'Bean-Field\n',
'8.',
'The',
'Village\n',
'9.',
'The',
'Ponds\n',
'10.',
'Baker',
'Farm\n',
'11.',
'Higher',
'Laws\n',
'12.',
'Brute',
'Neighbors\n',
'13.',
'House-Warming\n',
'14.',
'Inhabitants',
'and',
'Winter',
'Visitors\n',
'15.',
'Winter',
'Animals\n',
'16.',
'The',
'Pond',
'in',
'Winter\n',
'17.',
'Spring\n',
'18.',
'Conclusion\n',
'--',
'On',
'the',
'Duty',
'of',
'Civil',
'Disobedience',
'--\n',
'Economy\n',
'When',
'I',
'wrote',
'the',
'following',
'pages,',
'or',
'rather',
'the',
'bulk',
'of',
'them,',
'I',
'lived',
'alone,',
'in',
'the',
'woods,',
'a',
'mile',
'from',
'any',
'neighbor,',
'in',
'a',
'house',
'which',
'I',
'had',
'built',
'myself,',
'on',
'the',
'shore',
'of',
'Walden',
'Pond,',
'in',
'Concord,',
'Massachusetts,',
'and',
'earned',
'my',
'living',
'by',
'the',
'labor',
'of',
'my',
'hands',
'only.',
'I',
'lived',
'there',
'two',
'years',
'and',
'two',
'months.',
'At',
'present',
'I',
'am',
'a',
'sojourner',
'in',
'civilized',
'life',
'again.\n',
'I',
'should',
'not',
'obtrude',
'my',
'affairs',
'so',
'much',
'on',
'the',
'notice',
'of',
'my',
'readers',
'if',
'very',
'particular',
'inquiries',
'had',
'not',
'been',
'made',
'by',
'my',
'townsmen',
'concerning',
'my',
'mode',
'of',
'life,',
'which',
'some',
'would',
'call',
'impertinent,',
'though',
'they',
'do',
'not',
'appear',
'to',
'me',
'at',
'all',
'impertinent,',
'but,',
'considering',
'the',
'circumstances,',
'very',
'natural',
'and',
'pertinent.',
'Some',
'have',
'asked',
'what',
'I',
'got',
'to',
'eat;',
'if',
'I',
'did',
'not',
'feel',
'lonesome;',
'if',
'I',
'was',
'not',
'afraid;',
'and',
'the',
'like.',
'Others',
'have',
'been',
'curious',
'to',
'learn',
'what',
'portion',
'of',
'my',
'income',
'I',
'devoted',
'to',
'charitable',
'purposes;',
'and',
'some,',
'who',
'have',
'large',
'families,',
'how',
'many',
'poor',
'children',
'I',
'maintained.',
'I',
'will',
'therefore',
'ask',
'those',
'of',
'my',
'readers',
'who',
'feel',
'no',
'particular',
'interest',
'in',
'me',
'to',
'pardon',
'me',
'if',
'I',
'undertake',
'to',
'answer',
'some',
'of',
'these',
'questions',
'in',
'this',
'book.',
'In',
'most',
'books,',
'the',
'I,',
'or',
'first',
'person,',
'is',
'omitted;',
'in',
'this',
'it',
'will',
'be',
'retained;',
'that,',
'in',
'respect',
'to',
'egotism,',
'is',
'the',
'main',
'difference.',
'We',
'commonly',
'do',
'not',
'remember',
'that',
'it',
'is,',
'after',
'all,',
'always',
'the',
'first',
'person',
'that',
'is',
'speaking.',
'I',
'should',
'not',
'talk',
'so',
'much',
'about',
'myself',
'if',
'there',
'were',
'anybody',
'else',
'whom',
'I',
'knew',
'as',
'well.',
'Unfortunately,',
'I',
'am',
'confined',
'to',
'this',
'theme',
'by',
'the',
'narrowness',
'of',
'my',
'experience.',
'Moreover,',
'I,',
'on',
'my',
'side,',
'require',
'of',
'every',
'writer,',
'first',
'or',
'last,',
'a',
'simple',
'and',
'sincere',
'account',
'of',
'his',
'own',
'life,',
'and',
'not',
'merely',
'what',
'he',
'has',
'heard',
'of',
'other',
"men's",
'lives;',
'some',
'such',
'account',
'as',
'he',
'would',
'send',
'to',
'his',
'kindred',
'from',
'a',
'distant',
'land;',
'for',
'if',
'he',
'has',
'lived',
'sincerely,',
'it',
'must',
'have',
'been',
'in',
'a',
'distant',
'land',
'to',
'me.',
'Perhaps',
'these',
'pages',
'are',
'more',
'particularly',
'addressed',
'to',
'poor',
'students.',
'As',
'for',
'the',
'rest',
'of',
'my',
'readers,',
'they',
'will',
'accept',
'such',
'portions',
'as',
'apply',
'to',
'them.',
'I',
'trust',
'that',
'none',
'will',
'stretch',
'the',
'seams',
'in',
'putting',
'on',
'the',
'coat,',
'for',
'it',
'may',
'do',
'good',
'service',
'to',
'him',
'whom',
'it',
'fits.\n',
'I',
'would',
'fain',
'say',
'something,',
'not',
'so',
'much',
'concerning',
'the',
'Chinese',
'and',
'Sandwich',
'Islanders',
'as',
'you',
'who',
'read',
'these',
'pages,',
'who',
'are',
'said',
'to',
'live',
'in',
'New',
'England;',
'something',
'about',
'your',
'condition,',
'especially',
'your',
'outward',
'condition',
'or',
'circumstances',
'in',
'this',
'world,',
'in',
'this',
'town,',
'what',
'it',
'is,',
'whether',
'it',
'is',
'necessary',
'that',
'it',
'be',
'as',
'bad',
'as',
'it',
'is,',
'whether',
'it',
'cannot',
'be',
'improved',
'as',
'well',
'as',
'not.',
'I',
'have',
'travelled',
'a',
'good',
'deal',
'in',
'Concord;',
'and',
'everywhere,',
'in',
'shops,',
'and',
'offices,',
'and',
'fields,',
'the',
'inhabitants',
'have',
'appeared',
'to',
'me',
'to',
'be',
'doing',
'penance',
'in',
'a',
'thousand',
'remarkable',
'ways.',
'What',
'I',
'have',
'heard',
'of',
'Bramins',
'sitting',
'exposed',
'to',
'four',
'fires',
'and',
'looking',
'in',
'the',
'face',
'of',
'the',
'sun;',
'or',
'hanging',
'suspended,',
'with',
'their',
'heads',
'downward,',
'over',
'flames;',
'or',
'looking',
'at',
'the',
'heavens',
'over',
'their',
'shoulders',
'"until',
'it',
'becomes',
'impossible',
'for',
'them',
'to',
'resume',
'their',
'natural',
'position,',
'while',
'from',
'the',
'twist',
'of',
'the',
'neck',
'nothing',
'but',
'liquids',
'can',
'pass',
'into',
'the',
'stomach";',
'or',
'dwelling,',
'chained',
'for',
'life,',
'at',
'the',
'foot',
'of',
'a',
'tree;',
'or',
'measuring',
'with',
'their',
'bodies,',
'like',
'caterpillars,',
'the',
'breadth',
'of',
'vast',
'empires;',
'or',
'standing',
'on',
'one',
'leg',
'on',
'the',
'tops',
'of',
'pillars',
'--',
'even',
'these',
'forms',
'of',
'conscious',
'penance',
'are',
'hardly',
'more',
'incredible',
'and',
'astonishing',
'than',
'the',
'scenes',
'which',
'I',
'daily',
'witness.',
'The',
'twelve',
'labors',
'of',
'Hercules',
'were',
'trifling',
'in',
'comparison',
'with',
'those',
'which',
'my',
'neighbors',
'have',
'undertaken;',
'for',
'they',
'were',
'only',
'twelve,',
'and',
'had',
'an',
'end;',
'but',
'I',
'could',
'never',
'see',
'that',
'these',
'men',
'slew',
'or',
'captured',
'any',
'monster',
'or',
'finished',
'any',
'labor.',
'They',
'have',
'no',
'friend',
'Iolaus',
'to',
'burn',
'with',
'a',
'hot',
'iron',
'the',
'root',
'of',
'the',
"hydra's",
'head,',
'but',
'as',
'soon',
'as',
'one',
'head',
'is',
'crushed,',
'two',
'spring',
'up.\n',
'I',
'see',
'young',
'men,',
'my',
'townsmen,',
'whose',
'misfortune',
'it',
'is',
'to',
'have',
'inherited',
'farms,',
'houses,',
'barns,',
'cattle,',
'and',
'farming',
'tools;',
'for',
'these',
'are',
'more',
'easily',
'acquired',
'than',
'got',
'rid',
'of.',
'Better',
'if',
'they',
'had',
'been',
'born',
'in',
'the',
'open',
'pasture',
'and',
'suckled',
'by',
'a',
'wolf,',
'that',
'they',
'might',
'have',
'seen',
'with',
'clearer',
'eyes',
'what',
'field',
'they',
'were',
'called',
'to',
'labor',
'in.',
'Who',
'made',
'them',
'serfs',
'of',
'the',
'soil?',
'Why',
'should',
'they',
'eat',
'their',
'sixty',
'acres,',
'when',
'man',
'is',
'condemned',
'to',
'eat',
'only',
'his',
'peck',
'of',
'dirt?',
'Why',
'should',
'they',
'begin',
'digging',
'their',
'graves',
'as',
'soon',
'as',
'they',
'are',
'born?',
'They',
'have',
'got',
'to',
'live',
'a',
"man's",
'life,',
'pushing',
'all',
'these',
'things',
'before',
'them,',
'and',
'get',
'on',
'as',
'well',
'as',
'they',
'can.',
'How',
'many',
'a',
'poor',
'immortal',
'soul',
'have',
'I',
'met',
'well-nigh',
'crushed',
'and',
'smothered',
'under',
'its',
'load,',
'creeping',
'down',
'the',
'road',
'of',
'life,',
'pushing',
'before',
'it',
'a',
'barn',
'seventy-five',
'feet',
'by',
'forty,',
'its',
'Augean',
'stables',
'never',
'cleansed,',
'and',
'one',
'hundred',
'acres',
'of',
'land,',
'tillage,',
'mowing,',
'pasture,',
'and',
'woodlot!',
'The',
'portionless,',
'who',
'struggle',
'with',
'no',
'such',
'unnecessary',
'inherited',
'encumbrances,',
'find',
'it',
'labor',
'enough',
'to',
'subdue',
'and',
'cultivate',
'a',
'few',
'cubic',
'feet',
'of',
'flesh.\n',
'But',
'men',
'labor',
'under',
'a',
'mistake.',
'The',
'better',
'part',
'of',
'the',
'man',
'is',
'soon',
'plowed',
'into',
'the',
'soil',
'for',
'compost.',
'By',
'a',
'seeming',
'fate,',
'commonly',
'called',
'necessity,',
'they',
'are',
'employed,',
'as',
'it',
'says',
'in',
'an',
'old',
'book,',
'laying',
'up',
'treasures',
'which',
'moth',
'and',
'rust',
'will',
'corrupt',
'and',
'thieves',
'break',
'through',
'and',
'steal.',
'It',
'is',
'a',
"fool's",
'life,',
'as',
'they',
'will',
'find',
'when',
'they',
'get',
'to',
'the',
'end',
...]
#对words中每一个元素计算他出现的个数
#把统计结果保存到字典中,字典的key是单词,value是单词出现的次数
word_count={}
word_set=set(words)
for word in word_set:
count_num=words.count(word)
word_count[word]=count_num
word_count
{'cheat': 1,
'roof': 13,
'neighbors,': 7,
'chickadees': 2,
'18.': 1,
'corporal,': 1,
'month,': 1,
'As': 73,
'If': 110,
'Phoenicians': 1,
"student's": 1,
'pace,': 1,
'eloquent': 1,
'stable.': 1,
'particular': 27,
'that;': 2,
'end.': 4,
'alluvion': 1,
'stillness,': 1,
'hill,': 2,
'force.--\n': 1,
'appeared,': 1,
'guard': 2,
'intentions,': 1,
'sensuality': 4,
'votes?': 1,
'daylight,': 2,
'.................': 4,
'quakings': 1,
'humbler': 2,
'caves,': 2,
'drum': 1,
'vintage,': 1,
'alabaster': 1,
'Hoo': 2,
'violence': 1,
'(Iris': 1,
'speaker': 1,
'air.': 5,
'Daily': 2,
'hand,\n': 1,
'wines': 2,
'authors': 1,
'cow.': 1,
'repeat': 1,
'bargain': 2,
'fathomed': 2,
'hillsides': 2,
'place,"': 1,
'created,': 1,
'transformed': 1,
'some': 330,
'perhaps,': 16,
'circles': 8,
"countryman's": 1,
'injure': 1,
'listening,': 1,
'work.': 9,
'quack': 2,
'useful.': 1,
'dreaming': 3,
'Codman': 1,
'racked': 1,
'savage.': 2,
'"those': 1,
'judgment': 1,
'empire.': 1,
'ripe;': 1,
'uncertainty': 1,
'drained': 1,
'Nature?': 1,
'...........................': 1,
'They': 120,
'seen,': 7,
'rippling': 5,
'hearth,': 4,
'dews': 2,
'undoubted': 1,
'aspire': 2,
'strength.': 3,
'(Hirundo': 1,
'feels': 1,
'blossoms': 1,
'suited': 2,
'Paley': 1,
'Their': 9,
'edge': 9,
'Some': 29,
'Whalley;': 1,
'Romance': 1,
'manners': 4,
'Poverty\n': 1,
'coil': 1,
'promise': 1,
'winters,': 1,
'magnificence,\n': 1,
'certainly': 12,
'streets,': 4,
'fortune': 2,
'Should': 1,
'respective': 1,
'Candahars': 1,
'wiseacre': 1,
'tracks': 5,
'squares,': 1,
'surface.': 7,
'Rum.': 1,
'monuments.': 1,
'pantry,': 1,
'she': 38,
'veto': 1,
'calls': 5,
'pole,': 1,
'martyrs,': 1,
'yellow': 16,
'(Portulaca': 1,
'"so': 1,
'earth.': 7,
'engraven': 2,
'hills.': 3,
'Thither,': 1,
'beat.': 1,
'decided.': 1,
'and,': 70,
'lain': 6,
'gorge': 1,
'ether': 2,
'stranger': 2,
'beauty': 13,
'least";': 1,
'dived,': 1,
'health': 12,
'frozen,': 2,
'flow': 8,
'call': 24,
'possible,': 7,
'hunting-horn.\n': 1,
'compost': 2,
'driftwood': 3,
'stampede': 1,
'elderly': 2,
'unaccountable': 1,
'tremble.': 1,
'oh,': 1,
'In': 104,
'saint.': 1,
'decaying': 3,
'diverged,': 1,
'cellar-hole': 1,
'Entertainment.': 1,
'"was': 1,
'garden,': 2,
'great-grandmother': 1,
'plunges': 1,
'affections;': 1,
'unequal': 2,
'canoe': 1,
'character.\n': 1,
'case,': 12,
'pursue': 7,
'pest?\n': 1,
'36x.': 1,
'depths': 2,
'petition': 1,
'crushed,': 1,
'something;': 1,
'makes': 30,
'line,': 8,
'ornament': 2,
'soldier': 8,
'know': 109,
'visited': 11,
'himself.': 8,
'California': 1,
'Bottomless': 1,
'sleds,': 2,
'virtuous': 1,
'roasted.': 1,
'me\n': 1,
'rate': 2,
'skin,': 5,
'fiery': 1,
'boasting),': 1,
'crystal.': 1,
'least.\n': 1,
'placed,': 2,
'frog-pond': 2,
'tearless': 1,
'afforded': 5,
'"no': 1,
'winter': 69,
'famine': 1,
'taste': 9,
'mowing,': 1,
'him.': 36,
'except': 13,
'transcript.': 1,
'unexpectedly,': 1,
'confronts': 1,
'tax-bill': 1,
'quoted': 1,
'increase': 2,
'latch': 1,
'soaked': 1,
'rubbed': 1,
'workman': 2,
'arousing': 1,
'poetry.': 2,
'additional': 1,
'mists': 2,
'obscurity,': 1,
'legislators,': 2,
'amount': 10,
'glowing.': 1,
'caused': 4,
'afternoons': 2,
'externally': 1,
'outset,': 1,
'movable,': 1,
'earlier,': 1,
'time.': 16,
'Put': 1,
'firing': 2,
'caddis-worms': 1,
'quote': 1,
'another': 41,
'dissolve': 4,
'stake,': 2,
'designs': 4,
'lines,': 2,
'Brahma': 3,
'questionable': 1,
'digest': 1,
'fourteen': 1,
'rises,': 1,
'spherical': 1,
'parade,': 1,
'iron,': 2,
'shot,"': 1,
'microscope': 1,
'peddled': 1,
'shipwrecked': 2,
'tolerate': 1,
'furnishes': 1,
'profaned': 4,
'motions': 3,
'proved.': 1,
'tree;': 3,
'employs': 1,
'approaching': 3,
'Sympathy': 1,
'stroke': 1,
'governed': 4,
'dreams.': 1,
'soon?': 1,
'inferred': 2,
'woodchopper,': 1,
'years,': 15,
'fell,': 2,
'Winter,': 1,
'Again,': 2,
'forward': 8,
'theatre,': 1,
'flute': 2,
'himself.\n': 1,
'simoom,': 1,
'communicate.': 1,
'cabin\n': 1,
'disgrace.--\n': 1,
'human,': 1,
'maturing': 1,
'turtle.': 1,
'youth': 5,
'boundary': 2,
'More': 2,
'picturesque;': 1,
'wretchedness.': 1,
'moments,': 1,
'sullen': 1,
'greenish': 5,
'f': 1,
'annually,': 1,
'trust,': 2,
'Hebrews': 1,
'shift,': 1,
'operatives': 3,
'apples': 3,
'discourse': 2,
'works': 14,
'smiles': 1,
'find?': 1,
'engaged?': 1,
'shame,': 1,
'strive': 1,
'midst.\n': 1,
'about?': 1,
'cleaner': 1,
'irregularity': 1,
'frankness': 1,
'choice': 3,
'relic': 1,
'access': 2,
'singing,--\n': 1,
'blessing;': 1,
'created': 4,
'insect': 7,
'far;': 3,
'start': 6,
'zig-zag': 1,
'vision': 3,
'boys': 6,
'pickerel,': 4,
'bother': 1,
'amusements,': 1,
'fifty': 9,
'excessive': 1,
'planted': 8,
'review': 1,
'dawn': 2,
'Occasionally,': 1,
'vitreous': 1,
'prove,': 1,
'succeeded,': 1,
'ease,': 1,
'companion.': 1,
'forgot': 1,
'Well': 1,
'owing,': 2,
'hybrid': 1,
'weigh,': 1,
'left.': 3,
'Baker': 5,
'birth;': 1,
'gentleness': 1,
'dank,': 1,
'distilled,': 1,
'December.': 1,
'nook,': 1,
'changeable': 1,
'Israel.\n': 1,
'terminating': 1,
'disposition,': 1,
'fought': 4,
'knead': 1,
'denying': 1,
'falls': 5,
'gross.': 1,
'yesterday': 4,
'painful': 1,
'advise': 4,
'loads.': 1,
'mercury': 1,
'scream': 2,
'skillet,': 1,
'unsuspected': 1,
'parched': 1,
'neck': 5,
'Arabs,': 1,
'Howard,': 1,
'this': 440,
'row': 5,
'race.\n': 1,
'overlaid': 2,
'conspiracies\n': 1,
'Am': 1,
"Vitus'": 1,
'beets,': 1,
'standing': 35,
'obligation': 3,
'steadier': 1,
'timid': 1,
'commodities,': 1,
'design': 4,
'Broadway': 2,
'swelled': 1,
'bushel': 5,
'indescribable': 3,
'uniform': 1,
'slow?"\n': 1,
'squat': 3,
'counterbalance': 1,
'expenses,': 1,
'sins,': 1,
'faithfully;': 1,
'Hood,': 1,
'depositing': 1,
'unless': 14,
'compound': 1,
'scattering': 1,
'unjustly,': 1,
'nature.\n': 1,
'await': 4,
'professions': 3,
'successfully': 2,
'voice.': 1,
'run?': 1,
'sacrifice': 4,
'hard,': 5,
'consciences': 1,
'unspeakably': 1,
'skipping.': 1,
'prayers,': 1,
'eyes.': 3,
'Money': 1,
'inaccessible': 1,
'dearth': 1,
'channels,': 2,
'convention': 1,
'loon': 8,
'marsh': 2,
'tour': 1,
'request': 1,
'legitimately': 1,
'thin': 19,
'ceaseless': 1,
'sundered': 1,
'story-books,': 1,
'preaching': 1,
'rakes,': 1,
'packed': 1,
'hearth': 3,
'free;': 1,
'even.': 2,
'queer,': 1,
'impressive': 1,
'stars': 4,
'social,': 1,
'pot-herbs;': 1,
'satisfied': 12,
'leaves,': 6,
'massive': 1,
'customers;': 1,
"Lord's": 2,
'me': 246,
'covering': 2,
'fare?': 1,
'traced': 2,
'practising': 2,
'continued,': 1,
'disheartens': 1,
'24th,': 1,
'worked': 11,
'pertinently': 1,
'extinct': 1,
'can': 166,
'snaring': 1,
'a-blowing,\n': 1,
'waterlogged': 2,
'congealed': 1,
'no:': 1,
'indefinite': 1,
'vibratory': 1,
'desponding': 1,
'affected,': 1,
'conformably': 1,
'steppes': 1,
'refuge': 3,
'selfish;': 1,
'striped': 2,
'course.\n': 1,
'fretted': 1,
'freshet,': 1,
'ate': 2,
'degraded': 8,
'head': 26,
'heard.': 3,
'marble': 2,
'squirrel.': 1,
'amends': 1,
'employer': 1,
'succeeds,': 1,
'nations?': 1,
'trot.': 1,
'exhaustion': 1,
'lone': 2,
'misconception': 1,
'spirits!': 1,
'"Being': 1,
'pack,': 1,
'mouth,': 1,
'period.': 2,
'stall': 1,
'talk!': 1,
'apace;': 1,
'beach,': 1,
'spring-like': 1,
'obedient': 1,
'absent-minded': 1,
'beast,\n': 1,
'citizens': 1,
'none': 22,
'symbol.': 1,
'evil;': 1,
'half-starved': 2,
'regulates': 1,
'sub': 1,
'Garden,': 1,
'ocean': 5,
'ability,': 2,
'suppliant': 1,
'sandy': 10,
'digestive': 1,
'Clothing,': 4,
'audited,': 1,
'Mr.': 7,
'dull': 5,
'fail,': 3,
'kept,': 1,
'denomination': 1,
'shone': 4,
'observe,': 1,
'Patroclus,': 1,
'think.': 1,
'conceive': 2,
'indistinct,': 1,
'ages,': 1,
'childhood;': 1,
'unconscious.': 1,
'prostrate': 1,
'universities,': 2,
'intellect,': 1,
'hell,': 1,
'wants.': 1,
'36.78,\n': 1,
'Sutton,': 1,
'leading': 1,
'jest': 1,
'Recognize': 1,
'unlucky': 1,
'eyelashes': 1,
'less': 42,
'manurance,': 1,
'rounding': 1,
'squirrel': 5,
'Creator': 1,
'needed': 3,
'flourishing,': 1,
'daughter': 3,
'answering': 3,
'roast': 2,
'friends;': 1,
'--"\n': 1,
'coffee-mill,': 1,
"mind's": 3,
'DISOBEDIENCE\n': 1,
'turns': 6,
'tender': 9,
'armed': 3,
'hard-working,': 1,
'talking': 1,
'proceeding': 1,
'yet.': 2,
'heartily': 1,
'Easily,': 1,
'backing': 1,
'shadows': 5,
'town-clock': 1,
"o'clock,": 1,
'del': 2,
'chicken': 1,
'cluttered': 2,
'Sardanapalus,': 1,
'unwearied': 2,
'proportion.': 1,
'extremos': 1,
'Phaeton,': 1,
'handed': 1,
'hasty-pudding,': 1,
'salt;': 1,
'practiced': 1,
'owls': 2,
"farmers'": 1,
'unimpaired': 1,
'fertility': 3,
'Cannibal': 1,
'Too': 1,
'forenoon': 1,
'necessarily': 5,
'wonted': 1,
'reputation': 2,
'salted.': 1,
'masters': 2,
'ants;': 1,
'Saint': 1,
'falconry': 1,
'fault:': 1,
'expectations': 1,
'social': 6,
'writing:--': 1,
'gleam': 1,
'county.': 1,
'upward': 7,
'threnodies': 1,
'multa,': 1,
'unwearied!\n': 1,
'intending': 1,
'industrious': 1,
'bed.': 1,
'..............................': 1,
'luxuriant': 2,
'sportsman;': 1,
'mangy': 1,
'rank,': 1,
'breakfast.': 1,
'thankful': 2,
'Visitor': 1,
'quicksilver': 1,
'abstinence;': 1,
'white': 35,
'marble,': 2,
'ostriches,': 1,
'costs': 8,
'livelihood,': 1,
'butcher.\n': 1,
'hay-cart': 1,
'suggests,': 1,
'fastened': 6,
'swell': 1,
'accomplishment.': 1,
'scattered': 3,
'trembles': 1,
'fodder': 2,
'next': 40,
'zephyrs': 1,
'http://manybooks.net/\n': 1,
'sacrifices': 4,
'Nineteenth': 4,
'neglect': 1,
'squirrels,': 2,
'cost.': 1,
'world.': 10,
'drink.': 1,
'infirm': 1,
'evening,': 18,
'retreated': 1,
'marching': 2,
'owl;': 1,
'safely,': 2,
'are,': 15,
'faithfully,': 1,
'reckoning,': 1,
'water.': 11,
'board.\n': 1,
'opinion,': 4,
'communities': 1,
'comforts': 4,
'eloquence': 3,
'want,': 2,
'mounting': 1,
'architecture,': 2,
'institution': 6,
'reported': 3,
'lie,': 1,
'expectation': 1,
'Seen': 1,
'whoop.\n': 1,
'town': 24,
'wading': 3,
'loosely': 1,
'themselves.': 12,
'efforts,': 1,
'fruits,': 6,
'blows\n': 1,
'account;': 1,
'bird': 11,
'Flower': 1,
'determine': 1,
'origin': 2,
'commanding': 1,
'peel': 1,
'blow': 7,
'brass;': 3,
'luxuriantly.\n': 1,
'wanted,': 1,
'products;': 1,
"poet's": 1,
'forbid,': 1,
'ministerial': 1,
'straggling': 2,
'deep': 38,
'wildly': 1,
'Nutting,': 1,
'moon,': 2,
'Nature,': 11,
'compass': 3,
'prowling': 3,
'considering': 4,
'called': 38,
'sweep': 6,
'tomb.': 1,
'tails,': 1,
'complicated.\n': 1,
'wreath': 1,
'aspens': 1,
'drowsy': 1,
'peasant,': 1,
'Colorado': 1,
'religious': 3,
'handsome': 6,
'thyself.': 1,
'reads': 1,
'translation': 1,
'elbows.': 1,
'chew': 1,
'love': 37,
'kind,': 6,
'commerce,': 3,
'cart-path,': 1,
'quenched': 1,
'But,': 10,
'savages.': 1,
'mechanical': 2,
'flag,': 1,
'Already,': 1,
'enemies,': 1,
'runs.': 1,
'beholds': 2,
'begun': 6,
'transparency,': 1,
'Castalian': 1,
'trunk': 2,
'strains,': 1,
'cement': 1,
'savage;': 1,
'Enter': 1,
'sixteen': 2,
'choose.': 1,
'rivet': 1,
'faithfully': 3,
'reform?': 1,
'predicament': 1,
'flitted': 1,
'turnout': 1,
'depot': 1,
'relics.': 1,
'silences.': 1,
'coats,': 1,
'overshadow': 1,
'forthwith.': 1,
'Madras': 1,
'give.': 1,
'extends': 1,
'still.': 6,
'sweetbriers': 1,
'Inhabitants': 2,
'mode': 16,
'memorable.': 1,
'worth,': 1,
'hurled': 1,
'richer,': 1,
'groves.': 1,
'ripple': 6,
'infest': 1,
'bare,': 1,
'family;': 2,
'chest': 1,
'quaestus),': 1,
'disappearing': 1,
'indicative': 1,
'haughty': 1,
'gleamed': 1,
'Matter': 1,
'Hindoo,': 1,
'rust': 1,
'countrymen!': 1,
'hatred': 1,
'(what': 1,
'Concordiensis.': 1,
'paths': 2,
'subscribed': 1,
'bouquet': 1,
'bowers': 1,
'appeal': 4,
'cookery.': 1,
'probability': 1,
'oblong-square': 1,
'editor': 1,
'bankrupt': 1,
'Asiatic': 1,
'being': 95,
'complaining': 1,
'fruit': 10,
'is.': 8,
'streams,': 1,
'window,': 13,
'often': 43,
'abroad,': 1,
'opinions': 3,
'carried': 18,
'conical': 1,
'unknown.': 1,
'retain': 9,
'upward,': 1,
'lives,': 5,
'first;': 1,
'gentleman': 4,
'undulations': 3,
'foremost': 1,
'sauntered': 1,
'house?': 2,
'serenity.': 1,
'Petersburg': 1,
'late': 12,
'rain.\n': 1,
'mutual': 3,
'unwillingly': 1,
'knights': 1,
'Ben': 1,
'fro': 1,
'energy,': 2,
'capacious': 1,
'overlooking': 1,
'suggest': 8,
'treasured': 1,
'bricks': 9,
'"Because': 1,
'trespass,': 1,
'Dodona': 1,
'ones,': 7,
'men?\n': 1,
'value': 17,
'calculator': 2,
'Venetian': 1,
"Pope's": 1,
'triangles!': 1,
'again!': 1,
'spade': 4,
'dollar;': 1,
'sensually.': 1,
'watered,': 1,
'other."': 1,
'man;': 10,
'some,': 3,
'hunting,': 2,
'spirit,': 2,
'gauntlet,': 2,
'name,\n': 1,
'berries,': 2,
'Gorgon-like,': 1,
'track': 8,
'to?': 5,
'unwearied.': 1,
'recorded,': 1,
'chastity?': 1,
'fired': 1,
'society\n': 1,
'necessary': 28,
'downy': 1,
'existence': 6,
'Man': 8,
'mercies': 1,
'hang': 9,
'These,': 1,
'because': 56,
'helpless': 1,
'small': 63,
'merchants': 2,
'across-lot': 1,
'noticeable': 1,
'thrasher,': 1,
'paused': 1,
'hive,': 1,
'They,': 2,
'pebble;': 1,
'us': 66,
'bark,': 4,
'record,': 1,
'rods': 24,
'done,': 5,
'exclaimed': 1,
'irrepressible': 1,
'instance,': 10,
'Making': 1,
'seest': 1,
'inspired': 2,
'running': 10,
'raised,': 3,
'down.': 5,
'mariners.': 1,
'tasting': 1,
'organization': 1,
'necessities': 2,
'materials,': 3,
'why': 25,
'"comb,"': 1,
'for?': 1,
'recreate,': 1,
'families,': 2,
'thrust': 2,
'blessing,': 1,
'salutes': 2,
'song,': 1,
"there's": 1,
'carrier': 1,
'back,': 1,
"people's": 1,
'"some': 2,
'artillery,': 1,
'burs,': 1,
'memories,': 1,
'stalactites': 1,
'"John': 1,
'cavities,': 1,
'reflection': 3,
'finer': 5,
'surveyor,': 1,
'opportunity,': 1,
'shave': 1,
'mist,': 6,
'buckets': 1,
'lamplight,': 1,
'returning': 7,
'associations,': 1,
'booming': 2,
'basin.': 1,
'seeking': 6,
'pine': 39,
'cousins.\n': 1,
'fellow-men,': 1,
'dwelling': 6,
'burrow!': 1,
'riding': 1,
'louder,': 1,
'unfathomable.': 1,
'rods;': 1,
'laboriosus': 1,
'Canada,': 2,
'thou': 5,
'--': 450,
'sun': 49,
'poor;': 2,
'removal.': 1,
'stone.': 1,
'shirt': 1,
'reading,': 3,
'greater': 33,
'monkey': 1,
'teamster': 2,
'return': 10,
'Lincoln,': 3,
'idea,': 1,
'tailor.': 1,
'possessed,': 1,
'froze': 2,
'citizens.': 1,
'rules': 2,
'expediency;': 1,
'emptied,': 1,
'musky': 1,
'appreciate': 4,
'groove': 2,
'partly': 11,
'ear.': 1,
'reasons,': 1,
'mud,': 1,
'examining': 1,
'individual,': 3,
'front,': 2,
'transgress': 1,
'Japan,': 1,
'discern': 3,
'anxiety.': 1,
'spaded': 1,
'summer,': 16,
'unfenced': 1,
'messenger!': 1,
'pave': 1,
'wrested': 1,
'needle': 2,
'called,': 6,
"`Tittle-Tol-Tan,'": 1,
'hills,': 9,
'unable': 3,
'flight,\n': 1,
'oscillation': 1,
'melody': 1,
'mortarium': 1,
'extravagantly': 2,
'wings': 11,
'society,': 8,
'invented': 5,
'steep,': 1,
'devils,': 1,
'a-shopping': 1,
'bargain;': 1,
"world's": 2,
'investments': 1,
'cleansed': 3,
'"Symmes\'': 1,
'starting': 2,
'handles;': 1,
'Still,': 1,
'unfrequented': 4,
'exclusively': 3,
'plain,': 2,
'flock': 5,
'peas': 3,
'Let': 26,
'takes': 12,
'sleeps': 1,
...}
#对word_count字典进行排序,按照出现的次数(value)进行降序排序
sorted(word_count.items(),key=lambda item:item[1],reverse=True)
[('the', 6927),
('and', 4474),
('of', 3465),
('to', 3037),
('a', 2958),
('I', 1989),
('in', 1933),
('that', 1261),
('is', 1252),
('as', 1132),
('it', 1102),
('not', 1008),
('for', 921),
('was', 863),
('or', 854),
('with', 848),
('which', 835),
('my', 743),
('be', 715),
('his', 702),
('on', 675),
('have', 660),
('by', 660),
('but', 645),
('are', 642),
('he', 639),
('at', 605),
('they', 576),
('had', 529),
('their', 495),
('from', 495),
('--', 450),
('this', 440),
('if', 433),
('all', 411),
('so', 402),
('one', 400),
('The', 398),
('its', 385),
('were', 382),
('an', 377),
('we', 369),
('who', 345),
('more', 337),
('would', 333),
('some', 330),
('when', 318),
('than', 316),
('It', 290),
('our', 289),
('like', 282),
('no', 262),
('will', 261),
('you', 261),
('has', 253),
('me', 246),
('only', 246),
('there', 241),
('man', 237),
('any', 219),
('may', 215),
('what', 214),
('out', 213),
('into', 195),
('up', 194),
('do', 192),
('where', 190),
('most', 188),
('such', 188),
('never', 187),
('should', 180),
('over', 177),
('could', 172),
('him', 172),
('been', 167),
('can', 166),
('though', 166),
('many', 163),
('them', 159),
('men', 158),
('even', 158),
('it,', 156),
('without', 153),
('about', 152),
('other', 147),
('still', 145),
('much', 139),
('through', 138),
('But', 133),
('see', 133),
('very', 128),
('made', 127),
('those', 126),
('did', 121),
('long', 121),
('They', 120),
('your', 119),
('time', 118),
('how', 116),
('water', 114),
('these', 113),
('it.', 112),
('own', 111),
('life', 111),
('If', 110),
('first', 110),
('know', 109),
('every', 108),
('little', 107),
('house', 106),
('nor', 106),
('In', 104),
('two', 104),
('yet', 102),
('before', 101),
('He', 101),
('am', 101),
('down', 98),
('go', 97),
('make', 97),
('We', 97),
('far', 96),
('being', 95),
('heard', 95),
('think', 95),
('under', 95),
('When', 94),
('came', 94),
('might', 93),
('does', 93),
('while', 92),
('well', 92),
('great', 91),
('day', 91),
('now', 91),
('good', 91),
('woods', 90),
('after', 90),
('come', 89),
('There', 87),
('old', 86),
('get', 85),
('This', 85),
('pond', 84),
('same', 84),
('then', 83),
('new', 83),
('live', 83),
('must', 82),
('part', 81),
('her', 80),
('off', 80),
('ice', 79),
('last', 78),
('ever', 78),
('sometimes', 76),
('put', 74),
('once', 74),
('As', 73),
('whose', 73),
('few', 72),
('thought', 72),
('them.', 71),
('and,', 70),
('winter', 69),
('find', 69),
('got', 69),
('cannot', 69),
('us', 66),
('them,', 66),
('What', 65),
('life,', 64),
('small', 63),
('better', 63),
('feet', 63),
('till', 62),
('said', 62),
('A', 62),
('half', 62),
('Walden', 62),
('found', 61),
('way', 61),
('upon', 60),
('himself', 60),
('too', 59),
('pond,', 59),
('take', 58),
('read', 57),
('three', 57),
('let', 57),
('years', 57),
('thus', 57),
('because', 56),
('within', 56),
('One', 55),
('seen', 55),
('say', 55),
('is,', 55),
('shall', 54),
('true', 54),
('work', 54),
('saw', 53),
('whole', 53),
('day,', 53),
('things', 52),
('world', 52),
('enough', 52),
('house,', 52),
('almost', 52),
('nothing', 52),
('whether', 51),
('me,', 51),
('side', 51),
('went', 51),
('left', 51),
('between', 50),
('keep', 50),
('here', 50),
('poor', 50),
('myself', 50),
('morning', 50),
('also', 50),
('sun', 49),
('hear', 49),
('near', 49),
('wild', 49),
('perhaps', 49),
('And', 49),
('spring', 49),
('always', 48),
('round', 48),
('village', 48),
('each', 47),
('man,', 47),
('having', 47),
('place', 46),
('woods,', 46),
('earth', 46),
('surface', 45),
('summer', 45),
('commonly', 45),
('large', 44),
('best', 44),
('just', 44),
('look', 44),
('him,', 44),
('soon', 44),
('often', 43),
('For', 43),
('At', 43),
('less', 42),
('days', 42),
('another', 41),
('next', 40),
('making', 40),
('To', 40),
('against', 40),
('behind', 40),
('pine', 39),
('kind', 39),
('right', 39),
('leaves', 39),
('shore', 39),
('green', 39),
('she', 38),
('deep', 38),
('called', 38),
('again', 38),
("man's", 38),
('that,', 38),
('human', 38),
('love', 37),
('wood', 37),
('themselves', 37),
('night', 37),
('My', 37),
('looked', 37),
('sound', 37),
('Yet', 37),
('end', 37),
('him.', 36),
('air', 36),
('itself', 36),
('cut', 36),
('run', 36),
('Nature', 36),
('snow', 36),
('become', 36),
('lived', 36),
('standing', 35),
('white', 35),
('need', 35),
('quite', 35),
('State', 35),
('water,', 35),
('merely', 35),
('ten', 35),
('whom', 35),
('young', 34),
('fire', 34),
('away', 34),
('used', 34),
('seemed', 34),
('New', 34),
('above', 34),
('speak', 34),
('length', 34),
('told', 34),
('present', 34),
('hundred', 34),
('toward', 34),
('time,', 34),
('greater', 33),
('light', 33),
('lay', 33),
('there,', 33),
('lost', 33),
('least', 33),
('How', 33),
('rather', 33),
('took', 33),
('give', 32),
('set', 32),
('These', 32),
('rest', 32),
('both', 32),
('since', 32),
('shore,', 32),
('use', 32),
('eyes', 32),
('tell', 32),
('living', 32),
('me.', 32),
('along', 31),
('Indian', 31),
('lives', 31),
('Why', 31),
('ground', 31),
('natural', 31),
('stood', 31),
('done', 31),
('already', 31),
('makes', 30),
('You', 30),
('certain', 30),
('began', 30),
('labor', 30),
('it;', 30),
('thousand', 30),
('four', 30),
('several', 30),
('government', 30),
('Some', 29),
('common', 29),
('All', 29),
('hard', 29),
('wise', 29),
('worth', 29),
('learned', 29),
('year', 29),
('say,', 29),
('distant', 29),
('something', 29),
('foot', 29),
('necessary', 28),
('way,', 28),
('higher', 28),
('sort', 28),
('which,', 28),
('doubt', 28),
('dry', 28),
('among', 28),
('covered', 28),
('then,', 28),
('all,', 28),
('country', 28),
('want', 28),
('mile', 28),
('particular', 27),
('state', 27),
('So', 27),
('dark', 27),
('comes', 27),
('stand', 27),
('land', 27),
('trees', 27),
('going', 27),
('five', 27),
('feel', 27),
('head', 26),
('Let', 26),
('warm', 26),
('morning,', 26),
('men,', 26),
('door', 26),
('animal', 26),
('evening', 26),
('one,', 26),
('hands', 26),
('field', 26),
('night,', 26),
('wind', 26),
('back', 26),
('open', 26),
('looking', 26),
('why', 25),
('cold', 25),
('around', 25),
('this,', 25),
('sat', 25),
('sit', 25),
('Concord', 25),
('bottom', 25),
('mean', 25),
('probably', 25),
('sand', 25),
('Who', 25),
('home', 25),
('hand', 25),
('longer', 25),
('pay', 25),
('world,', 25),
('call', 24),
('town', 24),
('rods', 24),
('thick', 24),
('taken', 24),
('until', 24),
('appeared', 24),
('knew', 24),
('perchance', 24),
('forest', 24),
('form', 24),
('order', 24),
('mind', 24),
('nature', 24),
('course', 24),
('hardly', 24),
('free', 24),
('again,', 24),
('thy', 23),
('Such', 23),
('low', 23),
('passed', 23),
('ice,', 23),
('No', 23),
('fresh', 23),
('goes', 23),
('respect', 23),
('gone', 23),
('somewhat', 23),
('them;', 23),
('inches', 23),
('high', 23),
('kept', 23),
('off,', 23),
('work,', 23),
('none', 22),
('spend', 22),
('sides', 22),
('there.', 22),
('learn', 22),
('dead', 22),
('others', 22),
('says', 22),
('town,', 22),
('meet', 22),
('sweet', 22),
('rich', 22),
('suddenly', 22),
('long,', 22),
('race', 22),
('nearly', 22),
('instead', 22),
('words', 21),
('fine', 21),
('alone', 21),
('miles', 21),
('again.', 21),
('His', 21),
('food', 21),
('distance', 21),
('up,', 21),
('tree', 21),
('slight', 21),
('believe', 21),
('Every', 21),
('remember', 21),
('With', 21),
('greatest', 21),
('sense', 21),
('doing', 21),
('fall', 21),
('smooth', 21),
('middle', 20),
('farmer', 20),
('farm', 20),
('line', 20),
('turn', 20),
('thoughts', 20),
('railroad', 20),
('early', 20),
('felt', 20),
('experience', 20),
('winter,', 20),
('account', 20),
('gave', 20),
('red', 20),
('built', 20),
('various', 20),
('life.', 20),
('simple', 20),
('really', 20),
('either', 20),
('across', 20),
('beans', 20),
('another,', 20),
('simply', 20),
('thin', 19),
('least,', 19),
('bright', 19),
('surface,', 19),
('birds', 19),
('thinking', 19),
('side,', 19),
('eat', 19),
('walk', 19),
('single', 19),
('people', 19),
('wish', 19),
('full', 19),
('rain', 19),
('society', 19),
('black', 19),
('By', 19),
('things,', 19),
('That', 19),
('easily', 19),
('days,', 19),
('nearest', 19),
('ancient', 19),
('God', 19),
('body', 19),
('heat', 19),
('known', 19),
('Not', 19),
('door,', 19),
('anything', 19),
('Our', 19),
('daily', 19),
('Men', 19),
('name', 19),
('grass', 19),
('but,', 19),
('evening,', 18),
('carried', 18),
('leave', 18),
('pure', 18),
('neighbors', 18),
('hour', 18),
('part,', 18),
('shallow', 18),
('soil', 18),
('especially', 18),
('brought', 18),
('remarkable', 18),
('carry', 18),
('wholly', 18),
('history', 18),
('family', 18),
('caught', 18),
('level', 18),
('England', 18),
('appears', 18),
('sure', 18),
('fields', 18),
('.', 18),
('sun,', 18),
('face', 18),
('fish', 18),
('point', 18),
('afford', 18),
('sitting', 18),
('value', 17),
('Pond', 17),
('knows', 17),
('frequently', 17),
('directly', 17),
('laid', 17),
('amid', 17),
('us,', 17),
('path', 17),
('haste', 17),
('savage', 17),
('Though', 17),
('blue', 17),
('obliged', 17),
('proportion', 17),
('thirty', 17),
('rise', 17),
('interesting', 17),
('truth', 17),
('inch', 17),
('civilized', 17),
('houses', 17),
('sky', 17),
('bread', 17),
('hills', 17),
('inhabitants', 17),
('color', 17),
('times', 17),
('whatever', 17),
('reason', 17),
('music', 17),
('pitch', 17),
('broad', 17),
('reflected', 17),
('buy', 17),
('pines', 17),
('primitive', 17),
('hoe', 17),
('perhaps,', 16),
('yellow', 16),
('time.', 16),
('mode', 16),
('summer,', 16),
('gradually', 16),
('earth,', 16),
('mere', 16),
('myself,', 16),
('cost', 16),
('bottom,', 16),
('money', 16),
('wood,', 16),
('thing', 16),
('Even', 16),
('Pond,', 16),
('week', 16),
('bark', 16),
('Is', 16),
('met', 16),
('children', 16),
('traveller', 16),
('Many', 16),
('farther', 16),
('season', 16),
('hand,', 16),
('grew', 16),
('out,', 16),
('ground,', 16),
('important', 16),
('wonder', 16),
('Sometimes', 16),
('nearer', 16),
('means', 16),
('spent', 16),
('turned', 16),
('possible', 16),
('six', 16),
('appear', 16),
('grow', 16),
('asked', 16),
('else', 16),
('written', 16),
('indeed', 16),
('years,', 15),
('are,', 15),
('leaving', 15),
('himself,', 15),
('cultivated', 15),
('beautiful', 15),
('native', 15),
('coming', 15),
('support', 15),
('serve', 15),
('rare', 15),
('short', 15),
('bear', 15),
('completely', 15),
('ponds', 15),
('broken', 15),
('clear', 15),
('fear', 15),
('vast', 15),
('actually', 15),
('view', 15),
('however', 15),
('opposite', 15),
('noble', 15),
('business', 15),
('said,', 15),
('pleasant', 15),
('depth', 15),
('perchance,', 15),
('close', 15),
('beyond', 15),
('laws', 15),
('air,', 15),
('it.\n', 15),
('study', 15),
('clothes', 15),
('Perhaps', 15),
('Of', 15),
('modern', 15),
('fire,', 15),
('midst', 15),
('State,', 15),
('shelter', 15),
('On', 15),
('us.', 15),
('stones', 15),
('wear', 15),
('change', 15),
('men.', 15),
('Walden,', 15),
('build', 15),
('mass', 15),
('larger', 15),
('becomes', 15),
('only,', 15),
('faint', 15),
('clean', 15),
('day.', 15),
('art', 15),
('surprised', 15),
('works', 14),
('unless', 14),
('begin', 14),
('particularly', 14),
('country,', 14),
('likely', 14),
('English', 14),
('enjoy', 14),
('virtue', 14),
('who,', 14),
('paid', 14),
('dollars', 14),
('Or', 14),
('for,', 14),
('regard', 14),
('rising', 14),
('Most', 14),
('too,', 14),
('public', 14),
('case', 14),
('corn', 14),
('help', 14),
('ready', 14),
('past', 14),
('getting', 14),
('suppose', 14),
('seem', 14),
('road', 14),
('became', 14),
('hours', 14),
('latter', 14),
('raised', 14),
('influence', 14),
('distinguished', 14),
('forms', 14),
('wisdom', 14),
('says,', 14),
('forth', 14),
('spring,', 14),
('fell', 14),
('trees,', 14),
('another.', 14),
('Thus', 14),
('eye', 14),
('condition', 14),
('according', 14),
('stone', 14),
('roof', 13),
('beauty', 13),
('except', 13),
('window,', 13),
('road,', 13),
('equal', 13),
('vegetable', 13),
('keeps', 13),
('experience,', 13),
('deal', 13),
('leaf', 13),
('intervals', 13),
('one.', 13),
('catch', 13),
('light,', 13),
('comparatively', 13),
('burned', 13),
('soul', 13),
('you,', 13),
('grass,', 13),
('fit', 13),
('try', 13),
('hunter', 13),
('tried', 13),
('memorable', 13),
('apparently', 13),
('fishes', 13),
('discovered', 13),
('books', 13),
('or,', 13),
('wit', 13),
('rarely', 13),
('dinner,', 13),
('An', 13),
('still,', 13),
('observed', 13),
('yourself', 13),
('perch', 13),
('deepest', 13),
('different', 13),
('trade', 13),
('lower', 13),
('While', 13),
('worn', 13),
('eight', 13),
('consider', 13),
('away,', 13),
('grown', 13),
('room', 13),
('wont', 13),
('waters', 13),
('waste', 13),
('government,', 13),
('equally', 13),
('moral', 13),
('filled', 13),
('also,', 13),
('neighbor', 13),
('were,', 13),
('house.', 13),
('former', 13),
('dozen', 13),
('certainly', 12),
('health', 12),
('case,', 12),
('satisfied', 12),
('themselves.', 12),
('late', 12),
('takes', 12),
('requires', 12),
('weather', 12),
('walked', 12),
('Fair', 12),
('reading', 12),
('well,', 12),
('woodchuck', 12),
('farmers', 12),
('itself,', 12),
('character', 12),
('narrow', 12),
('beneath', 12),
('third', 12),
('meal', 12),
('before,', 12),
('together', 12),
('After', 12),
('live,', 12),
('houses,', 12),
('trust', 12),
('compared', 12),
('question', 12),
('direction', 12),
('struck', 12),
('end,', 12),
('bubbles', 12),
('drink', 12),
('care', 12),
('village,', 12),
('surrounded', 12),
('glad', 12),
('subject', 12),
('result', 12),
('length,', 12),
('purpose', 12),
('not,', 12),
('wall', 12),
('heaven', 12),
('me;', 12),
('hill', 12),
('once,', 12),
('solitary', 12),
('quarter', 12),
('cool', 12),
('perfect', 12),
('chiefly', 12),
('weather,', 12),
('humble', 12),
('honest', 12),
('cellar', 12),
('boat,', 12),
('Shall', 12),
('boat', 12),
('bare', 12),
('law', 12),
('neighborhood', 12),
('seek', 12),
('hollow', 12),
('heads', 12),
('oak', 12),
('do,', 12),
('forty', 12),
('finally', 12),
('furniture', 12),
('held', 12),
('beside', 12),
('during', 12),
('reminded', 12),
('beginning', 12),
('number', 12),
('visited', 11),
('worked', 11),
('water.', 11),
('bird', 11),
('Nature,', 11),
('partly', 11),
('wings', 11),
('note', 11),
('more,', 11),
('suggested', 11),
('usual', 11),
('hole', 11),
('dust', 11),
('perceive', 11),
('them.\n', 11),
('fact', 11),
('waves', 11),
('solid', 11),
('show', 11),
('first,', 11),
('him;', 11),
("one's", 11),
('wind,', 11),
('John', 11),
('raise', 11),
('genius', 11),
('well.', 11),
('pass', 11),
('obtain', 11),
('highest', 11),
('cast', 11),
('seed', 11),
('stones,', 11),
('bed', 11),
('lake', 11),
('stream', 11),
('window', 11),
('cars', 11),
('now,', 11),
('boy', 11),
('independent', 11),
('universal', 11),
('vital', 11),
('student', 11),
('be,', 11),
('worthy', 11),
('deep,', 11),
('lie', 11),
('so,', 11),
('ask', 11),
('parts', 11),
('sight', 11),
('lying', 11),
('worse', 11),
('wiser', 11),
('play', 11),
('break', 11),
('fast', 11),
('nations', 11),
('acquainted', 11),
('way.', 11),
('However,', 11),
('degree', 11),
('ears', 11),
('imagination', 11),
('Sometimes,', 11),
('river', 11),
('fifteen', 11),
('however,', 11),
('he,', 11),
('surely', 11),
('fair', 11),
('purity', 11),
('iron', 11),
('universe', 11),
('man.', 11),
('required', 11),
('feet,', 11),
('$', 11),
('war', 11),
('squirrels', 11),
('faith', 11),
('was,', 11),
('foreign', 11),
('advantage', 11),
('forever', 11),
('amount', 10),
('sandy', 10),
('world.', 10),
...]
file=open(r'c:\Users\Administrator\Desktop\Walden.txt','r')
lines=file.readlines()
words=[]
for line in lines:
tmp_list =line.split(" ")
for word in tmp_list:
words.append(word)
word_count={}
word_set=set(words)
for word in word_set:
count_num=words.count(word)
word_count[word]=count_num
sorted(word_count.items(),key=lambda item:item[1],reverse=True)