Python end=在print()调用中的含义

Python end=在print()调用中的含义,python,python-3.x,Python,Python 3.x,两者的区别是什么 print(a, end=' ') 及 在Python中?end是print函数的一个只包含关键字的参数,它声明将在print语句的末尾附加什么值。默认情况下,这是一个换行符 传递多个值以打印将使用str.join和关键字only sep参数(默认为“”作为分隔符)将它们连接在一起,因此 print(a, ' ') # prints the value of str(a) ' '.join'ed with a space # th

两者的区别是什么

print(a, end='  ')

在Python中?

end是print函数的一个只包含关键字的参数,它声明将在print语句的末尾附加什么值。默认情况下,这是一个换行符

传递多个值以打印将使用str.join和关键字only sep参数(默认为“”作为分隔符)将它们连接在一起,因此

print(a, ' ')     # prints the value of str(a) ' '.join'ed with a space
                  # then terminated with a newline
"a  \n"

print(a, ' ', sep="SEPARATOR")  # produces...
"aSEPARATOR \n"

print(a, end=' ') # prints the value of a, terminated with a space
"a "

欢迎来到堆栈溢出!这个问题真的不清楚-你能更新它,让它更具体地说明你在寻找什么吗?还要澄清问题是关于python还是jquery,因为您已经提到了其中一个,但标记了另一个……之后打印另一个字符串,您会注意到。
print(a, ' ')     # prints the value of str(a) ' '.join'ed with a space
                  # then terminated with a newline
"a  \n"

print(a, ' ', sep="SEPARATOR")  # produces...
"aSEPARATOR \n"

print(a, end=' ') # prints the value of a, terminated with a space
"a "