要在print之后的%后添加额外的空格,可以使用字符串格式化方法。以下是一个代码示例:
name = "John"
age = 25
# 使用字符串格式化方法,在print之后的%后添加空格
print("My name is %s." % name)
print("I am %d years old." % age)
输出结果:
My name is John.
I am 25 years old.
在输出结果中,%s和%d是占位符,用来表示字符串和整数的位置。在print之后的%后添加空格,只需在占位符之后添加空格即可。