Home >Backend Development >Python Tutorial >How to convert python to string

How to convert python to string

藏色散人
藏色散人Original
2019-10-25 10:56:1623255browse

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.

How to convert python to string

Then create a new function int_str

def int_str():

How to convert python to string

Define a variable, This variable is of numeric type.

a=123

How to convert python to string

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)

How to convert python to string

Print the value of b through the print function.

How to convert python to string

Call this function and select "run" on the menu, which means running.

How to convert python to string

How to convert python to string

You can see the running results of this program below.

How to convert python to string

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!

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