Make a template and apply it elementwise. Format & f-string notation do not require an explicit cast to string which make them preferable wrt an explicit string join, str.join.
Notice that for the f-string notation {} are escaped by nesting them {{}}. Then, to use format, you need a further nested pair.
You can pass your own element separator to the print to customize, with no extra manipulation, the final output.
myArray = [[1.23456, 2.4680, 13.579], [1, 2, 3]] sf = 6 # significant figures dp = 2 # decimal places apply_float_pattern = f"{{:{sf}.{dp}f}}".format el_SEP = ', ' line_SEP = '\n' # method 1 for a in myArray: print(*map(apply_float_pattern, a), sep=el_SEP)
Ouptut
1.23, 2.47, 13.58 1.00, 2.00, 3.00
or by constructing a single string representing the whole output
# method 2 output = line_SEP.join(el_SEP.join(map(apply_float_pattern, a)) for a in myArray) print(output)