Skip to content

Instantly share code, notes, and snippets.

@Zettt
Created November 19, 2012 19:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Zettt/4113101 to your computer and use it in GitHub Desktop.
Save Zettt/4113101 to your computer and use it in GitHub Desktop.
Daily Diary in Python for Pythonista ( Original post: http://tmblr.co/ZFavEyXHGqSe )
import webbrowser
import urllib
dayone_url = "dayone://post?entry="
feeling_question = "How do you feel today?"
achievement_question = "What are you trying to achieve today?"
thought_question = "Is there a negative thought or positive on your mind you want to get out?"
tag = "#diary"
# input
feeling = raw_input(feeling_question + "\n")
achievement = raw_input(achievement_question + "\n")
thought = raw_input(thought_question + "\n")
# concatenate
feeling_heading = "## " + feeling_question + " ##\n\n"
feeling = feeling + "\n\n"
achievement_heading = "## " + achievement_question + " ##\n\n"
achievement = achievement + "\n\n"
thought_heading = "## " + thought_question + " ##\n\n"
thought = thought + "\n\n"
diary_entry = feeling_heading + feeling + achievement_heading + achievement + thought_heading + thought + tag
# print out the result
print(diary_entry)
# url encode
diary_entry = urllib.quote(diary_entry)
# open in day one
webbrowser.open(dayone_url + diary_entry)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment