The python output statement "print()" is a styled output function used for printing output. The "print()" function will automatically wrap lines; the syntax of the printf() function is: "printf("
The printf() function is a stylized output function, and the output statement print() in python is used to print output.
##The syntax of the printf() function is: printf("
The most common function (in python3.X version to be precise). print is a function in Python3.x, but in Python2.x version it is not a function, just a keyword. The print() function automatically wraps lines.
1. Strings, values, variables (lists, dictionaries, tuples, etc.) can be output directly:
2. Formatted output: similar to Formatted output in C language
We make a simple summary of python formatted output:
(1). % character: Mark conversion instructions The beginning of the symbol
(2). Conversion flag: - means left alignment; means adding positive and negative signs before the converted value; "" (blank character) means leaving spaces before positive numbers; 0 means converting the value If there are not enough digits, fill it with 0
(3). Minimum field width: The converted string should have at least the width specified by this value. If *, the width is read from the value tuple.
(4). A dot (.) followed by a precision value: If a real number is converted, the precision value represents the number of digits that appear after the decimal point. If you are converting a string, this number represents the maximum field width. If it is *, then the precision will be read from the tuple
(5) String format conversion type
Recommended tutorial: "
python tutorial》
The above is the detailed content of What is the usage of python output statement print?. For more information, please follow other related articles on the PHP Chinese website!