예제 #1
0
    if (match_result_file_name not in file_list):
        #print('No match result file!')
        return

    with open(f'./match_data/{match_result_file_name}', 'r') as f:
        match_data = json.load(f)
        match_data_dict = json.loads(match_data)
        f.close()

    with open(f'./match_data/{match_odds_file_name}', 'r') as f:
        odds_data = json.load(f)
        match_odds_list = json.loads(odds_data)
        f.close()

    print('read dict len: ', len(match_data_dict))

    return match_data_dict, match_odds_list


if __name__ == '__main__':
    print_help()
    choice = input('please choice url:')

    match_result_dict, odds = read_match_result(choice)
    if match_result_dict is None:
        print('No match result file!')
        sys.exit()

    print_match_result(match_result_dict)
예제 #2
0
파일: test.py 프로젝트: milanll/python
# -*- coding: utf-8 -*-

#from get_match_data import get_id			#get_id(url)
import read_match_data
import soccer_comm
import re

soccer_comm.print_help()
choice = input('please choice url:')

match_data_dict, odds_dict = read_match_data.read_match_data(choice)

print('\n')
for (k, v) in match_data_dict.items():
    if ']' in v['team_one']:
        team_one = re.split(r']', v['team_one'])
        v['team_one'] = team_one[1]

#
for (k, v) in match_data_dict.items():
    if '[' in v['team_two']:
        team_two = re.findall(u"[\u4e00-\u9fa5]+", v['team_two'])
        v['team_two'] = team_two[0]

for (k, v) in match_data_dict.items():
    #print(soccer_comm.myAlign(v["team_one"], 20) + soccer_comm.myAlign(v['team_two'], 10))
    print("{0:<2}\t{1:{3}<8}\t{2:{3}<8}\t".format(len(v["team_one"]),
                                                  v["team_one"], v['team_two'],
                                                  chr(12288)))