python——使用format函数的优点

1.print(' {}{}'.format('数字:',0))     # 优势1:不用担心用错类型码。
2.print('{},{}'.format(0,1))              # 优势2不设置指定位置时,默认按顺序对应。
3.print('{1},{0}'.format(0,9))          # 优势3:当设置指定位置时,按指定的对应。
4.print('{0},{1},{0}'.format(0,1))   # 优势4:可多次调用format后的

原文地址:https://www.cnblogs.com/zxc01/p/12687701.html