Format string with all elements of a list

前端 未结 3 409
南旧
南旧 2021-01-23 02:50
words = [\'John\', \'nice\', \'skateboarding\']
statement = \"%s you are so %s at %s\" % w for w in words

produces

File \"

        
3条回答
  •  故里飘歌
    2021-01-23 03:17

    >>> statement = "%s you are so %s at %s" % tuple(words)
    'John you are so nice at skateboarding'
    

提交回复
热议问题