Home  >  Article  >  Backend Development  >  What does sep mean in python?

What does sep mean in python?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-06-21 09:36:3754182browse

The full name is Separate, which means separated
Used to customize the separator when printing two elements (the default is two spaces)

The keyword parameter sep is the implementation separator, such as multiple When outputting parameters, you want to output the middle delimiting character

What does sep mean in python?##

print(1, 2, 3, sep = ',', end = '\r\n')
print(1, 2, 3, sep = ' ', end = '\r\n')

Related recommendations: "

python video tutorial"

The result output is as follows:

1,2,3
1 2 3
print("file\n","abc","bcd","fff\n","poi")
print("-------------")
print("file\n","abc","bcd","fff\n","poi",sep='')
print("-------------")
print("file\n","abc","bcd","fff\n","poi",sep=' ')
print("-------------")

The result is:


file
 abc bcd fff
poi-------------file
abcbcdfff
poi-------------file
 abc bcd fff
poi-------------

The above is the detailed content of What does sep mean in python?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use pip in pythonNext article:How to use pip in python