Lets say I have the following tuple like string.
  (128, 020, 008, 255)

What is the best way to to remove leading zeroes and end up with the following.
  (128, 20, 8, 255)        -- I do not care about spaces

This is the solution I came up with
    s = "(128, 020, 008, 255)"
    v = s.replace ("(", "")
    v = v.replace (")", "")
    vv = ",".join([str(int(i)) for i in v.split(",")])
    final = "(" + vv + ")"


Thanks,
Bruce
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to