我将 type () 函数的结果存储在变量中,打印变量时出错

时间:2021-07-26 03:47:21

标签: python-3.x output concatenation spyder built-in-types

我尝试将列表类型存储在变量 v 中,并希望使用语句打印来显示它。我有一个错误。我怎样才能用 str 显示类型?

`#unpacking list into multiple variables
my =["3",5,"red"]
v=type(my)
print("the type of my is"+v)
r,i,o=my
print(r,i,o)`

错误: 只能将 str(不是“类型”)连接到 str

0 个答案:

没有答案