O*****c 发帖数: 171 | 1 Python: 有一个混合了子list和string的list, 如何判断元素是list还是string?
比如一个 isstring, islist之类的function or methods
thanks | P***t 发帖数: 1006 | | O*****c 发帖数: 171 | 3 thanks a lot! :)
【在 P***t 的大作中提到】 : search isinstance
| r****t 发帖数: 10904 | 4
But it is suggested to use
try:
____element + "a"
____#element is a string
except:
____element[:]
____#element is a list
【在 O*****c 的大作中提到】 : Python: 有一个混合了子list和string的list, 如何判断元素是list还是string? : 比如一个 isstring, islist之类的function or methods : thanks
|
|