0

Was looking for a method to delete files using a wildcard. Came across this question which helped me out. I thought the accepted answer was easier to understand and that's the method I would prefer.

However, it looks like the answer which utilizes the glob module is considerably more popular. What are the possible reasons for this? Is there an advantage that this method has over the accepted answer?

3
  • I would have posted a comment on the answer but 1. I don't have the reputation required and 2. It seemed more like a question Commented Jul 29, 2016 at 19:12
  • The asker appears to have had some issues getting glob to work, so did not accept it. Commented Jul 29, 2016 at 19:34
  • Yes, I see that, but I guess I was trying to point out the difference in upvotes received by the two answers as an indicator of the more popular answer. Commented Jul 29, 2016 at 20:00

1 Answer 1

0

There should be one-- and preferably only one --obvious way to do it.

The one obvious way to find all path names that match a pattern is the glob module, since that is what it is documented to do.

The accepted answer implements a subset of glob's functionality, it can find all files ending in .txt. It is not wrong, but it is not the One Way.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.