node = ['160', 'd6', '1'] t5 = '0' * (3 - len(node[-3])) + node[-3] t4 = node[-2][0] + '0' * (4 - len(node[-2])) + node[-2][1:] print t5, t4