我有一个列表/数组,我想对其进行字符串格式化。例如,
a = [1, 2, 3] and output that I want should be 010203
我试过了b = "%.2d %(a)"
,但是,它给了我一个错误TypeError: %d format: a number is required, not list
。当然,我可以理解这个错误,但是,我不知道其他方式。
代码应该是通用的,我的意思是,当我的列表像a = [10, 11, 12, 13]
时,它应该打印输出像10111213
.