", )"."/> ", )".">

Home  >  Article  >  Backend Development  >  What is the usage of python output statement print?

What is the usage of python output statement print?

烟雨青岚
烟雨青岚Original
2020-07-02 10:09:3123411browse

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("

What is the usage of python output statement print?

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:

What is the usage of python output statement print?

2. Formatted output: similar to Formatted output in C language

What is the usage of python output statement print?

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

What is the usage of python output statement print?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn