How to print types within a list

前端 未结 6 1705
自闭症患者
自闭症患者 2021-01-03 02:01

So I was given a list and I must print the type of each item in the list. I can clearly see that there are strings and integers but I need it to print out in Python. We just

6条回答
  •  渐次进展
    2021-01-03 02:47

    foo = [1, 0.2, "bar"]
    for i in foo:
        print(type(i))
    

    Should print out the type of each item

提交回复
热议问题