hi, everybody
today I gone to explain which I learnt.
列印() means printing a str, int, flo, etc.
Printing a String
when we want to print a string can use this syntax:
syntax:
1 |
|
eg:
1 2 |
|
Printing a variables
When we want to print a variables we can use this syntax
eg:
1 2 3 4 |
|
Printing into multiple items
You can print multiple items by separating them with commas.
eg:
1 2 3 4 5 6 |
|
Formatting with f-strings
An f-string is a way to format strings in Python. You can insert variables directly into the string by prefixing it with an f and using curly braces {} around the variables.
eg:
1 2 3 4 5 6 |
|
Concatenation of strings
We can combine the strings by this.
eg:
1 2 3 4 5 |
|
Escape sequencenes
Escape sequences allow you to include special characters in a string. For example, \n adds a new line.
eg:
1 2 3 4 |
|
Raw(r) strings
Raw stings are strings which type only which is give in the input.
eg:
1 2 |
|
Printing numbers
It used to print numbers.
eg
1 2 |
|
Printing the results of the expressions
This is used to find the value of a expression.
eg;
1 2 |
|
Printing lists and dictionaries
We can the entire lists and dictionaries.
eg:
1 2 3 4 |
|
using sep and end Parameters
We can use this to separate(sep) and end(end) with this parameters.
eg:
1 2 |
|
Triple Quotes
We can use this for print as a same.
eg:
1 2 3 4 5 6 7 |
|
String Multiplication
This is used to Multipling string.
eg:
1 2 |
|
This is learnt in the class of python print() class which is I leant by seeing Parotta Salna python class of Day-2
以上是列印()的詳細內容。更多資訊請關注PHP中文網其他相關文章!