Answers for "how to use str()"

0

how to use str()

#Use str() to convert a non string value into one
#Example:
VariableToConvert = 1
VariableAsAString = str(VariableToConvert)
#We can see that VariableAsAString is a string if we try do to operations on it.
#The result of trying an operation it would be: TypeError: can only concatenate str (not "int") to str
Posted by: Guest on June-25-2021

Python Answers by Framework

Browse Popular Code Answers by Language