syntax from diveintopython

Fredrik Lundh fredrik at pythonware.com
Tue Apr 17 13:38:27 EDT 2001


> Here's the code i've been working with.  I borrowed the code to create my
> own HTMLProc class.  The difficulties begin with the uknown_starttag
> function.  I keep getting a syntax error on the strattrs assignment.  I
> thought I copied the code verbatim but it still generates a syntax
> error.

what Python version are you using?

> def unknown_starttag(self, tag, attrs):
>    strattrs = "".join([' %(key)s="%(value)s"' % locals() for key, value in attrs])
>    self.parts.append("<%(tag)s%(strattrs)s>" % locals())

whoever wrote the original code should have their python license
revoked.

Cheers /F





More information about the Python-list mailing list