2019-07-02
阅读量:
547
python如何将内容转换为字符串?
str():此函数将所有内容转换为字符串。
# Python program showing
# a use of str() function
a = 1
print(type(a))
# converting integer
# into string
a = str(a)
print(type(a))
s =[1, 2, 3, 4, 5]
print(type(s))
# converting list
# into string
s = str(s)
print(type(s))
输出:
<class'int'>
<class'str'>
<class'list'>
<class'str'>






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论