中易网

python str函数怎么用

答案:2  悬赏:0  
解决时间 2021-01-16 09:55
python str函数怎么用
最佳答案
是将一个对象转成字符串显示,注意只是显示用,有些对象转成字符串没有直接的意思。
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。
全部回答
# 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))
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
初生婴儿用尿不湿还是纸尿裤好
如何使用阿里云服务器?
加油站(石脑中大道)怎么去啊,我要去那办事
众星捧月是什么意思
期盼翻造老屋的意义是什么
英雄联盟lol风墙能不能挡死歌大招 风墙实战测
比铝型材软点的材料除了铜之外还有什么?
keyascii=0代表什么
那感觉就像我的心也曾小鹿乱撞过可后来可能那
1000m丨尿素有多少克
非常之梦工厂是传销吗
wii色差线怎么接电视啊,这电视木有色差口,
我的电脑装了一个120G的固态硬盘,只有C,D两
aml52540m4g750r7bcn是联想的那款电脑?
战地4标准版都有什么地图
推荐资讯
我想问个问题,我要去桂林和阳塑四天,能推荐下
商标注册丢了,我要怎么才能补证,要多少时间
请问韦大红个性签名连笔怎么写?
是got7参加的什么综艺?
白鹭吃什么食物
目前市场黄金价格
不要嫌弃怎麼意思
将三又1/3写成两个整数,相除的式子是。
HTML5 真能代替 Flash 吗
IhopeI___nomistakesinmyworksofar.A、hadmad
《白种人-上帝的骄子》中作者说“小西洋人”
关于真帮人的问题
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?