python中str是什么函数_python str函数怎么用
展開全部
是將一個2113對象轉成字符串顯示5261,注意只是顯示用,有些對象4102轉成字符串沒有直1653接的意思。
str():將變量轉化為字符串類型
a = 1
b = [1, 2, 3]
str_a = str(a)
print(a)
print(type(a))
str_b = str(b)
print(b)
print(type(b))
The str() function is meant to return representations of values which are fairly human-readable, while repr() is meant to generate representations which can be read by
the interpreter (or will force a SyntaxError if there is not equivalent syntax). For objects which don't have a particular representation for human consumption, str() will
return the same value as repr(). Many values, such as numbers or structures like lists and dictionaries, have the same representation using either function. Strings and。
總結
以上是生活随笔為你收集整理的python中str是什么函数_python str函数怎么用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: h5活动是什么意思_深度|场景赋能H5,
- 下一篇: python json转字符串_pyth