python 中的 PRINT 函数

python 中的 print 函数

13-07-2024

打印()函数

print()函数是一个可以让我们输出到屏幕的函数

print() 函数有三种不同的用途;

单引号 (‘ ‘)双引号 (” “)三引号(“””“””)————用于多行

我们可以使用任何人输入的引用,不能在同一行中使用不同的引用

print()---------------------------#create empty line
print("jothilingam")--------------#string should print with""
print(5)------------------------#number can print without ""
print("jo""jo")--------------print without spaceprint("jo"+"jo")--------------print without spaceanswer    jojoprint("jo","jo")--------------print with spaceanswer     jo jo

用 f 弦打印

name = "jothi"print(f"hello {name}")# output : hello jothi

换行转义字符 n

print("jonthi")jothi

print()函数的参数:

单独参数

print("jo","jo",sep="_")...................sep="" is defaultanswer    jo_jo
print("jo", "lingam", sep='thi')answer     jothilingam

结束参数

print("jothi",end="lingam")answer  jothilingam
print("jothi",end="")----------------without spaceprint("lingam")answer  jothilingam
print("jothi",end=" ")----------------with spaceprint("lingam")answer  jothi lingam

* 参数

print(*"jothilingam")answer    j o t h i l i n g a m

file和flush参数,因为这些参数是允许我们处理文件的参数

立即学习“Python免费学习笔记(深入)”;

以上就是python 中的 PRINT 函数的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1348046.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年12月13日 11:41:48
下一篇 2025年12月13日 11:41:53

相关推荐

发表回复

登录后才能评论
关注微信