Listacular & Pythonista - Update

Hello! I wrote an improved version of this workflow. You can find it here.

At the end of my previous article, a few hours ago, I said that you could use the first line as the title of your plain text file and hyphenate the remaining items. This is how you do it (also, I found out a shorter way to do the last code, cutting down one loop, yay). Thank you Eric for cutting it down to almost a tweet.

from urllib import quote
from webbrowser import open

list = sys.argv[1].splitlines()

result = list[0] + '\n' + ("\n".join(('- ' + x) for x in list[1:]))

encoded = quote(result)

drafts = 'drafts://x-callback-url/create?text=' + encoded + '&action=Pytho-Groceries'


I won't explain much, name this rule on Pythonista as Convert2Listacular and also install these 2 following actions on Drafts. Due to limitations of Drafts and my laziness to explore the dropbox module at Pythonista, you can only create files using the First Line as a parameter for its title. You cannot append or prepend items to an existing list.

Convert to Listacular:


And Pytho-Groceries, which is a Dropbox action. If you had downloaded these actions from the previous article, there's no need to do it again.

This is all Pythonista for the day. Next I'll try to get rid of those damn commas required to add more than a single task to a list in Clear. Wish me luck!