-
Notifications
You must be signed in to change notification settings - Fork 1
/
prelaunch.py
64 lines (42 loc) · 1.25 KB
/
prelaunch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python
# coding: utf-8
import datetime
import re
import urllib.request
lstfechas = []
lstmd = []
hoy = datetime.datetime.now()
corte = re.compile('.*\s(.*)]')
with urllib.request.urlopen('https://raw.githubusercontent.com/openfootball/de-deutschland/master/2019-20/1-bundesliga.txt') as response:
data = response.read()
data2 = data.decode('utf-8')
filename = "core.txt"
archivo = open(filename, "w", newline = '\n')
data2 = data2.replace("ö", "oe")
data2 = data2.replace("ü", "ue")
lines = data2.splitlines()
for line in lines:
if line.startswith('Spieltag'):
md = line
#print(jornada)
if line.startswith('['):
fecha = line
fecha = corte.split(fecha)
fecha = fecha[1]
dia, mes, nada = fecha.split('.')
#print(mes)
mes = mes.zfill(2)
if int(mes) >= 8:
year = 2019
else:
year = 2020
date = datetime.datetime(year,int(mes),int(dia))
#print(date)
if date <= hoy:
lstfechas.append(date)
if md not in lstmd:
lstmd.append(md)
jornada = len(lstmd)
#print(lstmd)
#print(lstfechas)
#return jornada