You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import pymysql
|
|
|
|
import json
|
|
|
|
from functools import reduce
|
|
|
|
from blue_forecast import dict_sort, dict_rate
|
|
|
|
from pymysql.cursors import DictCursor
|
|
|
|
|
|
|
|
db = {
|
|
|
|
'host': 'home.rogersun.cn',
|
|
|
|
'user': 'root',
|
|
|
|
'password': 'Sxzgx1209',
|
|
|
|
'database': 'lottery'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def get_all_data():
|
|
|
|
conn = pymysql.connect(**db)
|
|
|
|
cursor = conn.cursor(DictCursor)
|
|
|
|
cursor.execute("SELECT * FROM history")
|
|
|
|
all_data = cursor.fetchall()
|
|
|
|
# print(all_data)
|
|
|
|
return all_data
|
|
|
|
|
|
|
|
|
|
|
|
def get_all_blue_rate():
|
|
|
|
all_blue = {}
|
|
|
|
all_data = get_all_data()
|
|
|
|
for data in all_data:
|
|
|
|
if data['blue'] in all_blue.keys():
|
|
|
|
all_blue[data['blue']] += 1
|
|
|
|
else:
|
|
|
|
all_blue[data['blue']] = 1
|
|
|
|
print(all_blue)
|
|
|
|
print('历史中篮球总概率:')
|
|
|
|
for k, v in dict_rate(dict_sort(all_blue, 'val', True)).items():
|
|
|
|
print(f"{k} - {v}")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
get_all_blue_rate()
|