+ 2

How to use the 2nd argument of print( ) in Python?

Actually I've found in some previous lessons abt using the 2nd arg for the print() func, maybe in some cmnts of the lessons, but now I can't recall or find the trick.. 🙁! I can recall that using the 2nd arg, one can chng the newline for each new output! So can anybody help on this kindly?

4th Dec 2022, 2:58 PM
Himubab Cryptic
Himubab Cryptic - avatar
3 Answers
+ 8
Syntax: print(object(s), sep=separator, end=end, file=file, flush=flush) Parameters: object(s) Any object, and as many as you like. Will be converted to string before printed sep='separator' Optional. Specify how to separate the objects, if there is more than one. Default is ' ' end='end' Optional. Specify what to print at the end. Default is '\n' (line feed) file Optional. An object with a write method. Default is sys.stdout flush Optional. A Boolean, specifying if the output is flushed (True) or buffered (False). Default is False
4th Dec 2022, 3:03 PM
JaScript
JaScript - avatar
+ 4
Hi, Himubab Cryptic ! When you don’t remember, start try using help. In your case: help(print) It gives often a lot of usful information about what you are looking for.
4th Dec 2022, 10:10 PM
Per Bratthammar
Per Bratthammar - avatar
+ 2
Thanks a lot bros!
4th Dec 2022, 10:53 PM
Himubab Cryptic
Himubab Cryptic - avatar