import os import string myfile=open("my-first-post.md","r") metatypes=["date:","title:","tags:"] lines=myfile.readlines() myfile.close() for line in lines: linelist=line.split() if "tags:" in line.lower() or "tag:" in line.lower(): #print line,"\n" if "tags:" in linelist[0].lower() or "tag:" in linelist[0].lower(): print "\nhere we go", commaCount=line.count(",")+1 linelist=linelist[1:] print linelist lineListCount=len(linelist) div=float(lineListCount)/float(commaCount) print div if div>0.74 and div<1.6: print line+" IS A TAGS LIST LINE" for item in linelist: #print item if "](" in item: splititem1=item.split("](") #print splititem1 splititem2=splititem1[0].split("[") print splititem2[1] if "](" not in item: print item
"Perhaps I'm old and tired, but I think that the chances of finding out what's actually going on are so absurdly remote that the only thing to do is to say, "Hang the sense of it," and keep yourself busy. I'd much rather be happy than right any day. ":
...Slartibartfast
© 2012