0

In python when is it advantageous to use 'sep' over 'join' or 'end'?

Whats the best time to use join or end or sep?

10th Feb 2020, 7:04 AM
Kanyanta Makasa
Kanyanta Makasa - avatar
1 Answer
+ 2
These are not really comparable I think, 'sep' and 'end' are attributes used along with `print` function. sep - Defines a character/string used as delimiter between arguments to print. By default, Python uses space for this. end - Defines a character/string to be printed after all the arguments had been printed. By default, Python uses line break for this. `join` is a method from `str` class that we can use to "glue" multiple string together to form a single string. Each of them has their own purpose and use cases, not comparable by advantage or timing : )
10th Feb 2020, 7:19 AM
Ipang