Created
August 17, 2016 13:23
-
-
Save ibanezmatt13/d35aa6263758b8de652e2969a877031d to your computer and use it in GitHub Desktop.
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
from newspaper import Article | |
url = u'http://fox13now.com/2013/12/30/new-year-new-laws-obamacare-pot-guns-and-drones/' | |
article = Article(url) | |
article.download() | |
article.parse() | |
a = article.text.encode("ascii", "ignore") | |
b = a.replace("\n", " ") | |
MORSE = {'a': '.-', | |
'b': '-...', | |
'c': '-.-.', | |
'd': '-..', | |
'e': '.', | |
'f': '..-.', | |
'g': '--.', | |
'h': '....', | |
'i': '..', | |
'j': '.---', | |
'k': '-.-', | |
'l': '.-..', | |
'm': '--', | |
'n': '-.', | |
'o': '---', | |
'p': '.--.', | |
'q': '--.-', | |
'r': '.-.', | |
's': '...', | |
't': '-', | |
'u': '.-', | |
'v': '...-', | |
'w': '.--', | |
'x': '-..-', | |
'y': '-.--', | |
'z': '--..' | |
} | |
def tx_morsed_word(morse_word): | |
for letter in morse_word: | |
for symbol in letter: | |
# here toggle hardware pins | |
if symbol == '.': | |
print "DOT" | |
else: | |
print "DASH" | |
print "\n" | |
print "\n\n\n" | |
def parse_word(word): | |
word2 = word.lower() | |
to_send = [] | |
for character in word2: | |
if character in MORSE: | |
to_send.append(MORSE[character]) | |
tx_morsed_word(to_send) | |
#for word in b.split(" "): | |
#parse_word(word) | |
parse_word("MattheW") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment