Nov-06-2017, 01:48 AM
Is there a better way of replacing [-2] position which is == '1' with '2'.
numbers = ['10237310', '10230010'] newlist = [b[0:-2] + '2' + b[-1] for b in numbers if b[-2] == '1'] ['10237320', '10230020']