Using elementtree to Create HTML Form / Set "selected"

Peter Otten __peter__ at web.de
Thu Aug 12 10:47:55 EDT 2010


Doug wrote:

> I'm using elementtree to create a form.
> 
> I would like to set the "selected" attribute.
> 
> Setting using the usual
>  option.set( "selected" = "" )

Maybe that should be option.set(selected="selected"). I think

<option selected="selected">

and

<option selected>

are equivalent.

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.3.4.2

> gives me
>   <option selected="" value="operations">Operations</option>
> how does one make
>   <option selected value="operations">Operations</option>
> which is what I need.




More information about the Python-list mailing list