Exemple #1
0
for e in elems:
    competition = Competition(e)
    competitionList.append(competition)

liveEvent = []
# For each competition, go to the corresponding page
for competition in competitionList:
    competition.addEvents()

    if competition.live:
        liveEvent.append(competition)

# liveEvent=competitionList

# Send email about live competitions
# sendHTMLEmail()

# Convert nested objects into a dictionnary for storage system
dictCompetitionList = []
for competition in competitionList:
    dictCompetitionList.append(competition.customDict())

with open("results.json", "w") as f:
    # print("\nCompetition list:")
    # print(dictCompetitionList)
    f.write(json.dumps(dictCompetitionList))

# print("Number of competitions:",len(elems))

# jsonStr = json.dumps(competitionList[0].__dict__)
# print(jsonStr)