Python Func Print
# Python3.x Python print() Function
[ Python3 Built-in Functions](#)
* * *
## Description
The **print()** method is used for printing output, one of the most commonly used functions.
The `flush` keyword argument was added in Python 3.3.
> In Python 3.x, `print` is a function, but in Python 2.x, it is not a function, just a keyword.
### Syntax
Here is the syntax for the print() method:
print(*objects, sep=' ', end='n', file=sys.stdout, flush=False)
### Parameters
* objects -- Plural, indicating that multiple objects can be output at once. When outputting multiple objects, they need to be separated by a comma (,).
* sep -- Used to separate multiple objects. The default value is a single space.
* end -- Used to specify what to end with. The default value is the newline character `n`, which can be replaced with another string.
* file -- The file object to write to.
* flush -- Whether the output is buffered usually depends on the file, but if the `flush` keyword argument is `True`, the stream is forcibly flushed.
### Return Value
None.
* * *
## Examples
The following demonstrates examples of using the print function:
## Test under Python3
>>>print(1)1>>>print("Hello World")Hello World>>>a = 1>>>b = ''>>>print(a,b)1 >>>print("aaa""bbb")aaabbb>>>print("aaa","bbb")aaa bbb>>>>>>print("www","","com",sep=".")# Set separator www.
Using the `flush` parameter to generate a Loading effect:
## Example
import time
print("--- EXAMPLE : Loading Effect---")
print("Loading",end ="")
for i in range(20):
print(".",end ='',flush =True)
time.sleep(0.5)
The effect is as shown below:
!(#)
For more content, refer to: (#)
[ Python3 Built-in Functions](#)
YouTip