Having problems with strings in HTML

James Stroud jstroud at ucla.edu
Tue Jun 27 00:24:03 CEST 2006


Kiana Toufighi wrote:
> Hi,
> 
> I get a very odd error:
> ValueError: unsupported format character 't' (0x74) at index 237
> 
> Here's my code:
> HI_LITE_FILE_NAME = '/var/tmp/out.txt'
> 
> print '''
>            <a 
> href="http://bbc.botany.utoronto.ca/ntools/cgi-bin/ntools_treeview_word.cgi?input=&max=2&values_off=no&remove_bracket=no&show_line_nr=yes&show_link_out=yes&decimal_places=10&show_classification=yes&db=arabidopsis&selection=any%20term&mode=&mode_nos=&yellow_blue=yes&local_file_name=%(OUT_FILE_NAME)s&show_instructions=no&expt_link=NASCArrays&max_adjust=2&view_size=large&highlight=%(HI_LITE_FILE_NAME)s">GraphicalOutput</a> 
> 
>         ''' % {'OUT_FILE_NAME': OUT_FILE_NAME, 'HI_LITE_FILE_NAME': 
> HI_LITE_FILE_NAME}
> 
> I wonder if this has something to do with HTML's % character.
> 
> KT
> 

Yes it does. Have a look at urllib.quote and unquote. These may help.

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list