Home > Article > Backend Development > Is sep a function in Python? How to use it?
Is sep a function in Python? How to use it?
sep in Python is not a function, it is a parameter of the print function, used to define the interval symbol between output data.
The specific usage is as follows:
When printing multiple strings at the same time, each string will automatically use spaces as the interval between each string by default.
print("abc", "uuu", "oop") # abc uuu oop
If you add sep = at the end of multiple strings, you can change the interval. For example, here we change it to no interval.
print("abc", "uuu", "oop", sep = "") # abcuuuoop
can also be changed to commas as intervals.
print("abc", "uuu", "oop", sep = ", ") # abc,uuu,oop
Of course special symbols are also acceptable.
print("abc", "uuu", "oop", sep = " & ") # abc&uuu&oop
If you use \n, it will wrap automatically as usual.
print("abc", "uuu", "oop", sep = " \n") # abc # uuu # oop
Many python training videos are all on the python learning network. Welcome to learn online!
The above is the detailed content of Is sep a function in Python? How to use it?. For more information, please follow other related articles on the PHP Chinese website!