Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.