Based on what you share, it seems to be a valid output of your code. Like an array. You can always access them using
index
, try that.
If you are still looking for replacement/cleanup option, there would be various ways to do it. If your numbers are separated by ',' always then use
split
/
replace
:
[int(n) for n in str.split(',') if n.isdigit()]
int(str.replace(',', ''))
If you want, you can always use
Regular expressions
though[
^]:
import rex
rex.sub("[0-9]+", "", str)
rex.sub(r',', "", str)
rex.sub(r'\D', "", str)
You can also use
join
/
filter
/
translate
type operations to clean up your string.
Use based on the situation and desired effect you need.