Justin Azoff wrote:
> Tom Plunket wrote:
>>      boilerplate = \
>> """
> [big string]
>> """
>>
>>      return boilerplate % ((module,) * 3)
>>
[deletia...]

> Of course..
> 
>>>> stuff = {'lang': 'python', 'page': 'typesseq-strings.html'}
>>>> print """I should read the %(lang)s documentation at
> ... http://docs.%(lang)s.org/lib/%(page)s""" % stuff
> I should read the python documentation at
> http://docs.python.org/lib/typesseq-strings.html

...or perhaps cooler:
http://docs.python.org/lib/node109.html

something like:

from string import Template

def GetPyContents(module):
        boilerplate = Template( \
"""
class $moduleName:
        pass
        
if __name__ == '__main__':
        import unittest
        unittest.main('${moduleName}_t')
""")
        
        return boilerplate.substitute(moduleName=module)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to