Python print() 函数的 end 参数详解
end 是 Python 中 print() 函数的一个参数,用于指定每次 print() 函数输出后的结尾字符,默认为换行符 '\n'。可以通过修改 end 的值来实现输出不同的结尾字符,如空格 ' ' 或逗号 ',' 等。例如:
print('Hello', end=' ')
print('world')
输出结果为:
Hello world
通过设置 end 参数,我们可以将多个 print() 函数的输出内容连接在一起,形成一个完整的字符串。
原文地址: https://www.cveoy.top/t/topic/mupF 著作权归作者所有。请勿转载和采集!