Python - short way to unpack list for string formatting operator?

前端 未结 3 1787
野性不改
野性不改 2021-01-12 01:27

Variations of the * or ** operators don\'t seem to work, unfortunately:

lstData = [1,2,3,4]
str = \'The %s are %d, %d, %d, and %d\' % (\'numbers\', *lstData)         


        
3条回答
提交回复
热议问题