Print Methods
Print() function is used to print the output in console and also it has the ability to handle formatting, special characters, Unicode and so on. We will see it one by one with examples
Basic usage
It prints the given text or data to the console.
Example
print("Hello, World!")
Output
Hello, World!
Printing Multiple Objects
It prints multiple objects with space as separator by default.
Example
print("Hello", "World")
Output
Hello World
Sep Parameter
We can override the default separator space by using the sep parameter.
Example
print("Hello", "World", sep=", ")
Here we used comma space as separator between the objects. Likewise we can use anything as separator.
Output
Hello, World
End Parameter
We can set what is printed at the end of the output using end parameter. It set as newline by default (\n).
print("Hello, World", end="!")
print(" How are you?")
Here we changed the new line parameter into exclamatory symbol using end parameter, so that both print methods are printed as single line as show below.
Output
Hello, World! How are you?
SOCIAL SHARE CARD GENERATOR