Python3 Input and Output
Output format beautification
Python has two ways of outputting values: expression statements and the print() function.
The third way is to use the write() method of the file object, which can be referenced by the standard output file.
If you want the output to be more varied, you can use the () function to format the output values.
If you wish to convert the output value to a string, you can use the repr() or str() function to do so.
str(): function returns a user-readable expression.
repr(): Produce an interpreter-readable expression.
Difference between python2 and python3 input and output:
1. python2 input:
1.1 raw_input() gets the raw input from the user:
1.2 input() executes user input as code:
2. python2 output:
Output in python2 can use spaces or parentheses:
3. python3 input:
In python3 version, there is no raw_input() function, only input(), and input in python3 has the same function as raw_input() in python2.
4 python3 output:
Output in python3 can only be in parentheses:
summarize
The above is a small introduction to the python2 and python3 input and output differences between the introduction, I hope to help you, if you have any questions please leave me a message, I will reply to you in time. I would also like to thank you very much for your support of my website!