pythonsep啥意思
全称为Separate意为分开、隔开。
用于print两个元素时自定义间隔符(默认为两个空格)
关键字参数sep是实现分隔符,比如多个参数输出时想要输出中间的分隔字符。
print(1, 2, 3, sep = ',', end = '')
print(1, 2, 3, sep = ' ', end = '
')
结果输出如下:
1,2,31 2 3
print("file","abc","bcd","fff
","poi")
print("-------------")
print("file
","abc","bcd","fff
","poi",sep='')
print("-------------")
print("file
","abc","bcd","fff
","poi",sep=' ')
print("-------------")
其结果为:
fileabc bcd fff
poi-------------file
abcbcdfff
poi-------------file
abc bcd fff
poi-------------
网,大量的免费python教程,欢迎在线学习!
以上是 pythonsep啥意思 的全部内容, 来源链接: utcz.com/z/537390.html