1. Python opening-summary of the print() function in python, the role of quotation marks and commonly used escape characters

The role of print() function

Tell the computer to display the content in the brackets on the brackets

The role of quotation marks and comparison with other languages

No quotes

Let the computer understand the content in the brackets and print the final result. such as:

输入:print(2*3);
结果:6

Quoted

Let the computer directly print the contents without understanding.

With double quotes

Let the computer directly print the contents without understanding. You can output single quotes in the content. For example: "I'm hungrg."

输入:print(''I'm hungrg.'');
结果:I'm hungrg.

With triple quotes

Achieve line wrapping (automatic line wrapping based on whether there are punctuation marks), or you can do line wrapping when you input, and the result of line wrapping will appear in the output, that is, the input is what you get.

Quotation marks in Java

The data quoted by single quotes is of char type, and the data quoted by double quotes is of type String; single quotes can only quote one character, and double quotes can quote 0 or more. Char is just a basic type, and String can be a class and can be directly referenced.

Quotation marks in C++

Double quotes indicate character strings, and single quotes indicate characters.
In the string, even if you only put one letter, in fact, the system will automatically add a \0 to it. Indicates the end. In other words, the string occupies one more place than what you see.
For example,'a' means letter a, "a" means "a,\0"

Common escape characters

Insert picture description here

Guess you like

Origin blog.csdn.net/Freedom_cao/article/details/107216015