I have a text file with lines like this one:
Cubo: 100% (left_x: 744 top_y: 395 width: 167 height: 181)
I would like to assign the appropiate int for each one of the variables, something like: left_x = 744, top_y = 395, width = 167, height = 181 but without having to do it manually.
>Solution :
You should probably use a dictionary, not variables, but you can use regex to parse it. E.g.
import re
s = 'Cubo: 100% (left_x: 744 top_y: 395 width: 167 height: 181)'
fields = s[s.index('(')+1:-1]
data = {x[0]:int(x[1]) for x in re.findall(r'([a-z_]+):\s+(\d+)', fields)}
print(data['left_x']) # 744