Skip to content

Instantly share code, notes, and snippets.

@jkeyoth
jkeyoth / PythonTemplates.py
Created March 5, 2011 05:51
Using templates in python with cheetah
from Cheetah.Template import Template
#The template text. Probably read in from a file for this project, but for an example I'll just use a string
templateDefinition = "This is a template. $exclamation$asdf"
#set up Template object
template = Template(templateDefinition)
#set the exclamation variable.
template.exclamation = "Woohoo"
@jkeyoth
jkeyoth / ReadVM.py
Created March 2, 2011 21:48
Read all .vm files in a directory in python
inPath = sys.argv[1]
if path.isdir(inPath):
for file in os.listdir(inPath):
if path.splitext(file)[1] == ".vm":
vmNames.append(inPath + "/" + file)