您好我是Web开发的新手,并且一直在使用python来制作我的网络应用程序。这是我的代码:
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 :(得分: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)