Hello, i'm new to this forum and to Python and i want to creat a function that counts the number of words on .txt file, but also that creats a dictionary with it, with the words has a key and the number of referencies to it has a value.
Thanks and best regards,
Luis Ventura
Luis Ventura 0 Newbie Poster
Recommended Answers
Jump to PostSounds good project, good luck. If you get stuck, you can post your effort, and regulars can help you point out where to look for solution. When posting, notice that pushing the (CODE) gets you tags to post code nicely with indention by pasting between them.
Jump to PostSounds like an application for collections.Counter.
First do the Python tutorial to learn the Python language.
http://docs.python.org/py3k/tutorial/index.html
Then review the library reference to get an overview of Python's built in …
Jump to Postchange line 6 condition.
Jump to PostNo it is not: you should be able to call the function like
print(words('texto.txt'))
(and you left in the old condition which was less strict)
Jump to PostBy fixing the parameter to be filename like specified.
All 37 Replies
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
lrh9 95 Posting Whiz in Training
vegaseat commented: very nicely said +15
Luis Ventura 0 Newbie Poster
lrh9 95 Posting Whiz in Training
Luis Ventura 0 Newbie Poster
lrh9 95 Posting Whiz in Training
Luis Ventura 0 Newbie Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Luis Ventura 0 Newbie Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Luis Ventura 0 Newbie Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Luis Ventura 0 Newbie Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Luis Ventura 0 Newbie Poster
lrh9 95 Posting Whiz in Training
Luis Ventura 0 Newbie Poster
lrh9 95 Posting Whiz in Training
Luis Ventura 0 Newbie Poster
Luis Ventura 0 Newbie Poster
snippsat 661 Master Poster
Luis Ventura 0 Newbie Poster
snippsat 661 Master Poster
Luis Ventura 0 Newbie Poster
Luis Ventura 0 Newbie Poster
snippsat 661 Master Poster
Luis Ventura 0 Newbie Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
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.