Home > Article > Backend Development > How to convert python to string
How to convert python to string?
First open the Python editor, and then write a comment for this program.
Then create a new function int_str
def int_str():
Define a variable, This variable is of numeric type.
a=123
Now we want to convert the value of the numerical type a into a string type, we use the str function, and then convert the value Assign a value to b
b=str(a)
Print the value of b through the print function.
Call this function and select "run" on the menu, which means running.
You can see the running results of this program below.
Recommended: "python tutorial"
The above is the detailed content of How to convert python to string. For more information, please follow other related articles on the PHP Chinese website!