Created
December 7, 2017 20:46
-
-
Save TAJD/544abfe85737d862dbc205574faf0c92 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
import click | |
@click.group() | |
def play_music(): | |
pass | |
@play_music.command() | |
def hello(): | |
click.echo('Here is our nokia composer! It accepts files containing music notes encoded in the microbit.music format.') | |
@play_music.command() | |
@click.argument('filename') | |
def print_song_file(filename): | |
"Open a text file containing notes in the microbit format and print it back to the command line." | |
with open(filename) as f: | |
s = f.read() | |
for i in s.split(): | |
print(i) | |
@play_music.command() | |
@click.argument('filename') | |
def open_song_file(filename): | |
"Open a text file containing notes in the microbit format." | |
with open(filename) as f: | |
s = f.read() | |
return s | |
if __name__ == '__main__': | |
play_music() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment