mirror of
https://github.com/ltcptgeneral/cse151b-final-project.git
synced 2024-11-12 22:26:19 +00:00
17 lines
387 B
Python
17 lines
387 B
Python
|
import pathlib
|
||
|
import sys
|
||
|
from string import ascii_letters
|
||
|
|
||
|
in_path = pathlib.Path(sys.argv[1])
|
||
|
out_path = pathlib.Path(sys.argv[2])
|
||
|
|
||
|
words = sorted(
|
||
|
{
|
||
|
word.lower()
|
||
|
for word in in_path.read_text(encoding="utf-8").split()
|
||
|
if all(letter in ascii_letters for letter in word)
|
||
|
},
|
||
|
key=lambda word: (len(word), word),
|
||
|
)
|
||
|
out_path.write_text("\n".join(words))
|