Simple string formatting question

Oleg Broytmann phd at
Tue Mar 14 17:00:33 CET 2000

On Tue, 14 Mar 2000, Matthew Hirsch wrote:
> print '%5.3f %5.3f %5.3f 1i'% 
> (temp_list[0],temp_list[1],temp_list[2],temp_list.index(min(temp_list)) 
> + 1)
> but it won't fit on one line.  It keeps thinking that I have two 
> separate incomplete statements.  What is the correct way to get around 
> this problem?  Thanks for your help.

print '%5.3f %5.3f %5.3f 1i'%  \
(temp_list[0],temp_list[1],temp_list[2],temp_list.index(min(temp_list)) + 1)

   (backslash is escape character; escaping end-of-line means continue)

    Oleg Broytmann      Foundation for Effective Policies      phd at
           Programmers don't die, they just GOSUB without RETURN.

More information about the Python-list mailing list