Skip to content

Instantly share code, notes, and snippets.

@Walkeryr
Created October 31, 2013 12:21
Show Gist options
  • Save Walkeryr/7248766 to your computer and use it in GitHub Desktop.
Save Walkeryr/7248766 to your computer and use it in GitHub Desktop.
Script that converts filenames to strings with HTML tags
from os import listdir
from os.path import isfile, join
mypath = '.'
prepend = '<a href=""><img src="'
append = '"></a>'
onlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) ]
html_tags = [prepend + f + append for f in onlyfiles]
for t in html_tags:
print t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment