.format使用

>>>"{} {}".format("hello", "world")    # 不设置指定位置,按默认顺序
'hello world'
 
>>> "{0} {1}".format("hello", "world")  # 设置指定位置
'hello world'
 
>>> "{1} {0} {1}".format("hello", "world")  # 设置指定位置
'world hello world'

 

 

posted @ 2020-01-27 15:29  学不会SLAM的  阅读(125)  评论(0编辑  收藏  举报