Format函數—字符串格式化

Format函數: 做用:格式化輸出字符串 格式: ‘’.format(value[,format_spec=’ ‘]) 示例: #位置匹配 >>> sun = ‘sunhziwen’ >>> s =43 >>> ‘my name is {}.’.format(sun) ‘my name is sunhziwen.’ >>> ‘my name is {1},I’m {0} years old.’.
相關文章
相關標籤/搜索