Created
February 9, 2022 11:22
-
-
Save nawada/7c3e454af86766fae6c2842087ca8cee to your computer and use it in GitHub Desktop.
Wordle用補助ツール
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in_file_path = '/usr/share/dict/web2' | |
files = [] | |
Dir.glob(in_file_path) do |file| | |
files.push(file) | |
end | |
five_char_words = [] | |
File.open(in_file_path) do |file| | |
file.each_line do |line| | |
line.strip! | |
if line.length === 5 && line.match?(/[a-zA-Z]{5}/) | |
five_char_words.push(line) | |
end | |
end | |
end | |
out_file_path = './five_words.txt' | |
File.open(out_file_path, 'w', 0755) do |file| | |
five_char_words.each do |word| | |
file.puts(word) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment