Python - print() 中的 end 参数
Python 中的 print() 函数始终创建换行符。不过,此函数还有一个参数,可以加在其他字符上,而不是在最后加入换行符。在本文中,我们将探讨此参数的各种选项。
示例
以下示例显示了我们可以将值赋值给 end 参数的各种方法,以及查看其中的结果。
print("Welcome to ")
print("Tutorialspoint")
print("Welcome to ", end = ' ')
print("Tutorialspoint")
print("emailid",end='@')
print("tutorialspoint.com")输出
运行以上代码会得到以下结果:
Welcome to Tutorialspoint Welcome to Tutorialspoint emailid@tutorialspoint.com
广告
数据结构
网络
关系数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
JavaScript
PHP