param_list = parser_top.parse() if 'odds' in param_list == False: print("No odd param") sys.exit() parser_odds_top = prot.parser_odds_top('/JRADB/accessO.html', param_list['odds']) kaisai_list = parser_odds_top.parse() param_list_x = [] param_list_x.append(param_list['odds']) for kaisai in kaisai_list: kaisai_place_list = kaisai['kaisai_list'] for kaisai_place in kaisai_place_list: parser_odds_kaisai = prok.parser_odds_kaisai('/JRADB/accessO.html', kaisai_place['param']) param_list_x.append(kaisai_place['param']) race_list = parser_odds_kaisai.parse() for race in race_list: if 'win' in race: param_list_x.append(race['win']) if 'waku' in race: param_list_x.append(race['waku']) if 'uma' in race: param_list_x.append(race['uma']) if 'exacta' in race: param_list_x.append(race['exacta']) if 'wide' in race: param_list_x.append(race['wide']) if 'trio' in race: param_list_x.append(race['trio'])
import sys sys.path.append('../') from jra import parser_top as pr from jra import parser_odds_top as prot from jra import parser_odds_kaisai as prok from jra import parser_odds_win as prow use_network = True _parser = prok.parser_odds_kaisai('/JRADB/accessO.html', 'pw15orl00062017040320170916/CE') if use_network: list = _parser.parse() else: args = sys.argv if len(args) < 2: print("Specify Test File Name") sys.exit() with open(args[1], 'rb') as rfp: response_body = rfp.read().decode("'shift_jis'") list = _parser.parse_html(response_body) for race in list: print("レース : {}".format(race['no'])) print(" 発走 : {}".format(race['status'])) if 'name' in race: