format()具有强化字符串格式化的功能
print("1、{} {}".format("hello","world"))
print("2、{0} {1}".format("hello","world"))
print("3、{1} {0} {1}".format("hello","world"))
运行结果:
1、hello world
2、hello world
3、world hello world
format()具有强化字符串格式化的功能
print("1、{} {}".format("hello","world"))
print("2、{0} {1}".format("hello","world"))
print("3、{1} {0} {1}".format("hello","world"))
运行结果:
1、hello world
2、hello world
3、world hello world