Quicker Tag Generation
Quicker Tag Generation
When I was creating the last post I was thinking writing out a long list of tags is a pain in the neck. For one or two tags this is easy especially when I can copy and paste from my previous post. However, when adding more tags then this the process starts to get awkward. I've come up with a quick and dirty solution to this problem. I've used the python programming language to create a very quick 'script' to get the job done.
Here it is:
tags = raw_input("Enter a list of tags separated by commas:"
).split(',')
html = [
'<a href="http://technorati.com/tag/%s" rel="tag">%s</a>'
% (t.strip(), t.strip()) for t in tags]
open('tags.txt', 'w').write(
"<b>Tags:</b> " + ", ".join(html
))
Given a line of text like such as "security,windows,install,software" the script takes this list of tags and adds the HTML tag code around the list. It then saves the list to a file called tags.txt.
Tags: tags, scripts
When I was creating the last post I was thinking writing out a long list of tags is a pain in the neck. For one or two tags this is easy especially when I can copy and paste from my previous post. However, when adding more tags then this the process starts to get awkward. I've come up with a quick and dirty solution to this problem. I've used the python programming language to create a very quick 'script' to get the job done.
Here it is:
tags = raw_input("Enter a list of tags separated by commas:"
).split(',')
html = [
'<a href="http://technorati.com/tag/%s" rel="tag">%s</a>'
% (t.strip(), t.strip()) for t in tags]
open('tags.txt', 'w').write(
"<b>Tags:</b> " + ", ".join(html
))
Given a line of text like such as "security,windows,install,software" the script takes this list of tags and adds the HTML tag code around the list. It then saves the list to a file called tags.txt.
Tags: tags, scripts
4 Comments:
Sweet. I still need to try this. You know what my problem is? I never know what to tags to use!
I am lame. I am totally lame. I tried this ten times but it showed up with a bunch of the codes not just the tags. What am I doing wrong? :(
IT WORKED - you were right about what I was doing wrong.
Anyone who reads this - James is a genius when it comes to explaining technology to people who are not familiar with it.
This comment has been removed by a blog administrator.
Post a Comment
<< Home