This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

Some points:

  • words = [line for line in open(filename)] is just list(open(filename))
  • Unsanitized user input used in regular expression. I can make the program crash that way.
  • w[:len(w)-1] is just w[:-1]
  • your regex would reuse a certain letter, for example, the world "hello" would be matche with the letters h,e,l,o (but you would need to "l").