'How to format a Selenium element text

I'm making a code where the data I get is, for example: ['10:20'], but I need to format this element to get only the number before :

This is a clock, but it is a string, I need to format this information or convert it to float, so that I can perform calculations with it

How can I do this?

tempo = [my_elem.text for my_elem in driver.find_elements(By.CLASS_NAME, "ml1-SoccerClock_Clock ")]

print("\nTempo de jogo",tempo)

My output

Tempo de jogo ['07:01']


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source