2013年4月28日日曜日

python 2 python 3 気づいた違い文字列フォーマット

「みんなのPython Webアプリ編」58ページ
python 3.1では文字列フォーマットが変わる
%がサポートされなくなる
16行目
%s

{f}
20行目
%s
{ff}
 に変える
f,ffは適当

56行目
 print (html_body % (options,content)).encode('utf-8')↲

 print ((html_body).format(f=options,ff=content).encode('utf-8'))↲
にかえるとできた