在Python中,可以使用字符串的format()方法或者f-string来插入变量的值到字符串中。 使用format()方法: name = "Alice" age = 30 sentence = "My name is {} and I am {} years old.".format(name, age) print(sentence) 复制代码 使用f-string: name = "Alice" age = 30 sentence = f"My name ...