How can I change any data type into a string in Python?
myvariable = 4 mystring = str(myvariable) # '4'
also, alternatively try repr:
mystring = repr(myvariable) # '4'
This is called "conversion" in python, and is quite common.
2.1m questions
2.1m answers
60 comments
57.0k users