diff --git a/dictate.py b/dictate.py index 1969226..3ad480b 100644 --- a/dictate.py +++ b/dictate.py @@ -66,7 +66,7 @@ def quote(config, engine): x = random.randint(0, len(quotes)-1) quote = quotes[x] print(f'{quote['quote']}\n\t\t\t - {quote['author']}') - dictation = quote['quote'].split(' ') + dictation = filter(None, quote['quote'].split(' ')) # turn the string into a list of words, the filter function removes empty strings # Dictate the quote for word in dictation: engine.say(word) @@ -88,7 +88,7 @@ def file(config, engine): print(line) # Dictation loop for line in lines: - for word in line.split(' '): + for word in filter(None, line.split(' ')): # the filter function removes empty strings engine.say(word) engine.runAndWait() # Break between words as determined by the wpm