i want to get the number from a string
Example:
a = '22,123 games'
Result:
result = 22123
i want to get the number from a string
Example:
a = '22,123 games'
Result:
result = 22123
First you need to find where the number is. I assume that it's before the first space, so
number = a[0 : a.find(' ')]
Then you have to remove commas:
noCommas = number.replace(',', '')
And then convert to int:
res = int(noCommas)