beautifulsoup parse every html files in a folder webscrapping [closed]
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . My task is to read every html file from a directory. Conditions are to find whether each file contains tags (1) <strong>OO</strong> (2) <strong>QQ</strong> Then 回答1: Your write function is nested in the for loop, that's why you write multiple lines to your index.txt , just move the write out of the loop and put