I have a problem, I want to add some number between them, but only for some condition, I have a list from web scraping with number and space, the number is a time a soccer match is played by the player, and the space is if the player have score during this match, 1 space = 1 goal, 2 space = 2 goal 3 space : 3 goal.
So when I import in a excel I can make a rule color, with "space" and see really quick witch match he have scored or not.
Now I want to know, since how many min the player have not score, and when it score, the counter of min reset to 0.
So I wrote this :
for list in lists:
go = list.find('td', class_="tj1").text.replace('\xa0', '').replace("'","")
goo = [go]
print(goo)
and the result is :
['90 ']
['90 ']
['90 ']
['90 ']
['90 ']
['68 ']
['27']
['90']
['78 ']
As you can see, there is space in the string, it's the number of score the player have done in this match ( here it's Neymar ), you can see there is two result here :
['27']
['90']
there is no space, so the player have no score in there match, so I have to tell python, to add the number between them and tell me the result as " MAX MIN WITHOUT SCORE "
and the count : " NOT SCORE A GOAL SINCE ? MIN ", if the player score, the count : "NOT SCORE A GOAL SINCE ? MIN " reset to 0.
So I wrote this
for list in lists:
go = list.find('td', class_="tj1").text.replace('\xa0', '').replace("'","")
goo = [go]
print(go)
x = go.isdigit()
print(x)
and the result is :
90
False
90
False
90
False
90
False
90
False
68
False
27
True
90
True
78
False
So now, python can see witch one have space, and which one don't have, so my question, how can I do for add number with the condition "True" and tell me the " MAX MIN WHITOUT SCORING " and reset to zero if in the next match it's score for having " NOT SCORED SINCE ? MIN "
I hope I was clear in my question, thanks for your time, it's very appreciated.
some exemple of what I want :
90
False
90
False
90
False
90
False
90
False
68
False
27
True
90
True
78
False
Result :
MAX MIN WITHOUT SCORING = 90 + 27 = 117 min
NOT SCORED SINCE ? MIN = 0 min
other exemple :
90
True
90
True
90
True
90
False
90
False
68
False
27
False
90
True
78
True
Result :
MAX MIN WITHOUT SCORING = 90 + 90 = 90 = 270 min
NOT SCORED SINCE ? MIN = 90 + 78 = 168 min