name = "Alice" age = 30 city = "Paris" # 使用format()函数嵌套传入变量 message = "Hello, my name is {}. I am {} years old and I live in {}.".format(name, age, city) print(message)
输出结果:
Hello, my name is Alice. I am 30 years old and I live in Paris.