From: Rahul Goswami Date: Wed, 28 Feb 2018 19:42:26 +0000 (+0000) Subject: Update xkcd_password.py X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=c76a7cf64588e306de4a66a49aa666e03cd83ae4;p=redacted-XKCD-password-generator.git Update xkcd_password.py --- diff --git a/xkcdpass/xkcd_password.py b/xkcdpass/xkcd_password.py index 81b0b26..aee8319 100755 --- a/xkcdpass/xkcd_password.py +++ b/xkcdpass/xkcd_password.py @@ -122,7 +122,7 @@ def generate_wordlist(wordfile=None, max_length = min_length wordfile = locate_wordfile(wordfile) - words = [] + words = set() regexp = re.compile("^{0}{{{1},{2}}}$".format(valid_chars, min_length, @@ -132,9 +132,9 @@ def generate_wordlist(wordfile=None, for line in wlf: thisword = line.strip() if regexp.match(thisword) is not None: - words.append(thisword) + words.add(thisword) - return list(set(words)) # deduplicate, just in case + return list(words) # deduplicate, just in case def wordlist_to_worddict(wordlist):