Can I access the English dictionary to loop through matches in morse code? If not can I copy and paste it from some place onto just afew lines?

泄露秘密 提交于 2019-12-04 15:03:16
ate50eggs

There is a dictionary tool for python called enchant. Check out this thread.

How to check if a word is an English word with Python?

What fun is Morse code if you can't hear it? Let me know if this doesn't work in Python 2.7:

from winsound import Beep
from time import sleep

dot = 150 # milliseconds
dash = 300 
freq = 2500 #Hertz
delay = 0.05 #delay between beeps in seconds

def transmit(morseCode):
    for key in morseCode:
        if key == '.':
            Beep(freq,dot)
        elif key == '-':
            Beep(freq,dash)
        else:
            pass #ignore (e.g. new lines)
        sleep(delay)

example = '----. ----.   -... --- - - .-.. .   --- ..-.   -... . . .-.'
#This last is the first line of
#99 Bottles of Beer in Morse Code
#from http://99-bottles-of-beer.net/language-morse-code-406.html

transmit(example)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!