📜  如何使用 str() - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:18.504000             🧑  作者: Mango

代码示例1
#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