###エラー文
IndexError: list index out of range
###ソースコード抜粋
python
1def hogehoge(self): 2 # 経過時間計測用 3 begin_time = time.time() 4 base_path = os.getcwd() + '/xbrl_files' 5 6 # writerオブジェクト生成 7 resultCsvWriter = csv.DictWriter( 8 open('eggs.csv', 'w', encoding=self.encode_type), self.default_tag + self.custom_tag, lineterminator="\n") 9 resultCsvWriter.writeheader() 10 11 # 対象ファイルを抽出 12 xbrl_files = self.fild_all_files(base_path) 13 count = 0 14 for xbrl_file in xbrl_files: 15 count += 1 16 print('getting data...' + xbrl_file) 17 info_dicts = self.parse_xbrl(xbrl_file) 18 dump_file(resultCsvWriter, info_dicts)
python
1 def parse_xbrl(self, file_path): 2 # parse xbrl file 3 with open(file_path, 'r', encoding='utf-8') as of: 4 xbrl = XBRLParser.parse(of) # beautiful soup type object 5 result_dicts = defaultdict(list) 6 _idx = 0 7 8 # print xbrl 9 name_space = 'jp*' 10 for node in xbrl.find_all(name=re.compile(name_space + ':*')): 11 if self.ignore_pattern(node): 12 continue 13 14 row_dict = defaultdict(list) 15 # default tag 16 row_dict['file_nm'] = file_path.rsplit('\\' or '/', 1)[1] 17 row_dict['element_id'] = node.name 18 row_dict['amount'] = node.string 19 20 # cutom tag 21 for tag in custom_tag: 22 row_dict[tag] = self.get_attrib_value(node, tag) 23 24 result_dicts[_idx] = row_dict 25 _idx += 1 26 return result_dicts
###心境
どう書いたら治るのかわからない。。。
やばい、、、、、、、、
###一言
とても困っています。。。
助けてください、、、!!!
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。