partial string formatting

前端 未结 21 1123
野的像风
野的像风 2020-11-28 04:30

Is it possible to do partial string formatting with the advanced string formatting methods, similar to the string template safe_substitute() function?

F

21条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 05:03

    >>> 'fd:{uid}:{{topic_id}}'.format(uid=123)
    'fd:123:{topic_id}'
    

    Try this out.

提交回复
热议问题