make python program count the number of two words on a webpage (for instance, 'keep' and 'delete') and return it.

Recommended Answers

All 3 Replies

Use a tuple of the two words as dictionary index. Piece of cake.

Of course you have to figure out how to separate the words from the HTML, but there's plenty of libraries out there.

This smells a bit like homework. But in general, just usl Urllib to get the text from the webpage and then just use the string.count() function to get what you want.

When you ask questions like this its good to show people where you are up to in the code and not just asking for a straight out solution to your (homework?) problem.

Member Avatar for leegeorg07

i agree with paulthom this does seem like 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.