Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import re
- tags_source = "../lookups/tags.csv"
- tags_conf = "../default/tags.conf"
- ti = open(tags_source)
- to = open(tags_conf,"w")
- line = ti.readline()
- comment_line = re.compile("^[\s#]+")
- while line:
- if not comment_line.match(line):
- parts = line.split(",")
- if len(parts[0]) > 0 and len(parts[1]) > 0 :
- tmpStr = "[%s=%s]\n"%(parts[0].strip(),parts[1].strip())
- for tag in parts[2:]:
- if len(tag) > 1:
- tmpStr = tmpStr + "%s = enabled\n"%tag.strip()
- tmpStr = tmpStr + "\n"
- to.write(tmpStr)
- line = ti.readline()
- to.close()
- ti.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement