小编Gau*_* TP的帖子

IndexError:索引超出范围:7

我正在使用名为Financial Data Quality Management Enterprise Edition(FDMEE)的Oracle EPM产品.我编写了一个Jython脚本来解析数据文件并将其推送到FDMEE产品模式中的自定义表.

当我推送数据文件的子集时,它工作正常.但是当我解析整个数据文件时,它失败并出现错误IndexError:index超出范围:7.

以下是我收到的错误消息:

File "\\vmhodvesip4\D$\SVESI7\Custom\FDMEEApps\BFRVN/data/scripts/event/BefImport.py", line 5, in <module>

    if row[7]=='JAN':

IndexError: index out of range: 7
Run Code Online (Sandbox Code Playgroud)

以下是我使用的代码:

import csv

recReader = csv.reader(open('D:/SVESI7/Custom/FDMEEApps/BFRVN/inbox/BF_Reven_Load/Test03big.txt'), delimiter='!')
for row in recReader:
    if row[7]=='JAN':
        period_num = '1'
    elif row[7]=='FEB':
        period_num = '2'
    elif row[7]=='MAR':
        period_num = '3'
    elif row[7]=='APR':
        period_num = 4
    elif row[7]=='MAY':
        period_num = 5
    elif row[7]=='JUN':
        period_num = 6
    elif row[7]=='JUL':
        period_num = 7
    elif row[7]=='AUG':
        period_num = 8
    elif row[7]=='SEP':
        period_num = 9
    elif …
Run Code Online (Sandbox Code Playgroud)

python python-2.7 jython-2.5 jython-2.7

5
推荐指数
1
解决办法
670
查看次数

标签 统计

jython-2.5 ×1

jython-2.7 ×1

python ×1

python-2.7 ×1