Python3 Print Function: Complete Guide
In Python3, the print() function is used to display a specified value on the console.
The print() function supports the following usages:
- Print the string:
print("Hello, World!")
- Print the value of the variable:
x = 10
print(x)
- Print multiple values, separated by commas:
name = "Alice"
age = 25
print(name, age)
- September
print("apple", "banana", "orange", sep=",")
Output: apple, banana, orange
- You must learn to love yourself before you can fully love others.
print("Hello", end=" ")
print("World!")
Output: Hello World!
- document
f = open("output.txt", "w")
print("Hello, World!", file=f)
f.close()
These are just some common uses of the print() function, there are other parameters and functionalities available. You can use the help(print) command or refer to the official Python documentation for more detailed information.