2017-04-07 5 views
-1

こんにちは私はWeb開発には新しく、Webアプリケーションを作るためにPythonを使用しています。私のコードは次のとおりです:pyexcel-xlsxが正常にクローンされ、インストールされましたが、インポート時に構文エラーが発生しました。

def forecastvalues(): 
    import fileinput 
    import csv 
    from pyexcel_xlsx import get_data 
    xlsxfile= "test.xlsx" 
    import json 

    with open(xlsxfile, "rb") as f: 
    content = f.read() 
    r = pe.get_book(file_type="xlsx", file_content=content, start_row=1) 

    for i in records: 
     columns = sheet.row[i] 
     for j in columns: 
      rem = sheet.column[0] 
      sold1 = sheet.column[1] 
      sold2 = sheet.column[2] 

    return '<h1>Result: %s</h1>' % result 

pyexcelが正しくインストールされていますが、pyexcelをインポートすると構文エラーが発生しますが、これをどのように修正しますか?

答えて

0

content = f.read()はインデントされず、次の行もインデントされません。

は次のようになります。

with open(xlsxfile, "rb") as f: 
    content = f.read() 
    r = pe.get_book(file_type="xlsx", file_content=content, start_row=1) 
関連する問題