htnawsaj

Markdown_Html.py

Aug 13th, 2013
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. ##Markdown Converter##
  2.  
  3. import markdown2
  4. import os
  5. os.chdir("/storage/emulated/0/markdown")
  6. for files in os.listdir("."):
  7.     if files.endswith(".txt"):
  8.         html_filename = files.strip('.txt') + ".html"
  9.         if not os.path.exists(os.path.join("/storage/emulated/0/markdown", html_filename)):
  10.             html_file = open(html_filename, "w")
  11.             html = markdown2.markdown_path(files)
  12.  
  13.             html_file.write(html)
  14.             html_file.close()
Advertisement
Add Comment
Please, Sign In to add comment