我遇到的问题是我的程序无法处理我从excel电子表格中提取的货币对象。除了更改货币的错误之外,代码运行并执行我想要的操作。这是我执行代码时出现的错误。是否有建议?
FutureWarning:很快将更改Currency对象,因此使用decimal.Decimal实例。 (设置pythoncom。 future_currency 以立即获取这些对象。)
以下是我正在运行的代码:
import sys, os, win32com.client, glob
from win32com.client import constants
xl = Excel_Document()
headerlist = ['STUDYDES','STUDYDES2','EVENTTYPE','AssessmentSOLUTIONTYPE','AssessmenFDNS-TERMINATION','SOLUTIONTYPE','FDNS-TERMINATION','GROUP','SCENARIO','ProviderOASISReservation','CustomerName','RequestedStart_Date']
ListofData = []
Data = []
counter = 1
xlslist = glob.glob('*tblFacilityLog*.xls')
for xls in xlslist:
headers = {}
sortedvalues = []
output = {}
print 'Opening Workbook: ',xls
xl.openWorkbook(xls)
sheetdata = xl.getSheetData('tblAllFacilityLog')
xl.closeWorkbook()
for row in sheetdata:
sortedvalues = []
for header in headerlist:
if header in sheetdata[0]:
output[header] = row[sheetdata[0].index(header)]
else:
output[header] = "'None'"
for header in headerlist:
sortedvalues.append(output[header])
Data.append(sortedvalues)
ListofData.append(Data)
print 'Building Workbook'
print len(Data)
print len(ListofData)
xl.addWorkbook()
xl.addWorksheet("tblFacilityLog9")
xl.selectSheet("tblFacilityLog9")
beginrow = 1
lastrow = beginrow + len(Data)
#xl.pasteData(headerlist, startcol = beginrow, startrow = beginrow, endcol = len(headerlist), endrow = 1)
for Data in ListofData:
xl.pasteData(Data, startcol = 1, startrow = 1, endcol = len(headerlist), endrow = lastrow)
xl.saveWorkbook("CombinedLog")
xl.closeWorkbook()
xl.closeApp()
答案 0 :(得分:0)
此错误表示:如果现在有效,请忽略警告。如果它你不会更新pythoncom模块,那么你没有问题。如果你想尽快使用更新版本的pythoncom,那么你可以通过
来试用新功能import pythoncom
pythoncom.__future_currency__ = True # I guess it is True
这是我对错误的理解。