eg: 换行 end=”\n”
eg: 空格 sep=” “
补充:python 中的 print(x, end=) 和 print(x, sep=)
print(x, end=)
for i in range(10):
print(i)
输出结果:
0 1 2 3 4 5 6 7 8 9
for i in range(10):
print(i, end=” “)
输出结果:
0 1 2 3 4 5 6 7 8 9
参数 end 默认打印换行, 即 end = “\n”
print(x, sep=)
sep 用于做打印拼接
print("hello", "world", sep=":")
打印结果:
hello:world
以上为个人经验,希望能给大家一个参考,也希望大家多多支持华域联盟。
您可能感兴趣的文章:
声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。


评论(0)