2016-09-01 3 views
1

私は特定の書式設定を使ってtxtファイルを新しいtxtファイルに変換しようとしていますので、ウェブサイトに直接置くことができます。ループ内のリスト項目の参照部分

統計情報の見出しの下にある項目の統計情報というリストを作成しましたが、テキストを特定の方法でフォーマットするようにループを作成しようとしていますが、無効な構文エラーが表示されます。ここで

は..私がこれまで持っているもの

txt = open(html_file, 'a') 
    txt.write('<h5><a href="http://www.learningplusuk.org/data/education-reform" target="_blank"><strong>Education Reform</strong></a></h5>' 
      '\n' 
      '<p>All the latest information on qualification reform can be found via our website, in the ‘Education Reform’ section.</p>' 
      '\n' 
      '<hr>' 
      '\n' 
      '<p>Statistics and Data</p>' 
      '\n' 
      '<hr>' 
      '\n') 
for i in stats: 
    j,k = enumerate(stats.split("\t")) 

txt.write('<h5><a href=/"'i.split("\t")[4]'" target="_blank"><strong>'i.split("\t")[1]'</strong></a></h5>' 
      '\n' 
      '<h5><strong>'i.split("\t")[2]'</strong></h5>' 
      '<p>'i.split("\t")[3]'<br></p>' 
      '<hr>' 
      '\n') 
txt.close() 

ですが、それはi.splitが無効な構文であると言います。助言がありますか?

ありがとうございます!

答えて

関連する問題