Your goal is to write a Python function that takes a file handle as input and returns the most common words in the text file

This appears to be part of a homework assignment, in which txt files are required but you didn’t attach them to your post.

Where are you stuck with this assignment? Are you getting any error messages? Please show us the code you have so far and explain where you’re stuck so that we can help you.

I really wish assignments were a little more unique. Over at Rosettacode there are over 34 solutions in over 20 languages.
https://rosettacode.org/wiki/Word_count

Why I shared this is to show it doesn't take much to find solutions but you can't use those if this is homework.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.