Last active
February 7, 2023 03:45
-
-
Save ellieLitwack/7e66d6908baab1b7c039996b10f6d5be to your computer and use it in GitHub Desktop.
Extract a word list for Monkey Type from a ZipChord chord file, then copy it to the clip board
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
import pyperclip # library for copying to clipboard | |
# open the chords file and read the lines | |
file = open(input('Enter the path to the debug.txt file: '), 'r') | |
lines = file.readlines() | |
file.close() | |
word_list = [] | |
# iterate through the lines | |
for line in lines: | |
# if the line does not contain a tap character, skip it | |
if line.find('\t') == -1: | |
continue | |
else: | |
# take everything after the tab character as the word | |
word = line[line.find('\t')+1:] | |
# if the word has a ~ | |
if word.find('~') != -1: | |
continue | |
else: | |
# remove any newline characters | |
word = word.replace('\n', '') | |
# add the word to the word list | |
word_list.append(word) | |
# join word list on | character without newlines | |
word_string = '|'.join(word_list) | |
# copy it to the user's clipboard | |
pyperclip.copy(word_string) | |
print("Word list copied to clipboard with pipe delimiters.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment