July 16, 2003

Repetive HTML

I had to write some HTML that required an alphabetical list of tags, one for each of the letters of the alphabet and cooked up some Python to do it:
for c in range(ord('A'),ord('Z')+1):
    text = text + '<a href="vgLink.SearchProducts?next=Next&previous=Previous \
&results_per_page=10&vgvar_1_name=productname \
&vgvar_1_operator=VALUE_STARTS_WITH \
&vgvar_1_value=%c">%c</a>' %(c,c)
print text
Posted by stuartcw at July 16, 2003 05:28 PM
Comments