Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
How can I convert any data type format into a string format data in Python?

1 Answer

0 votes
by (108k points)

You can use the str() for converting the data into string format data: 

myvariable = 4

mystring = str(myvariable)  # '4'

You can also use repr():

mystring = repr(myvariable) # '4'

This is commonly known as "conversion" in python.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 2, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...