我有一个函数,它产生一个看起来像这样的数组:
[(1, 3, 'test data')]
该数组中的任何数据都可以更改,所以我不能只是做
print(x[1:])
我需要打印数组中的所有字符串。任何想法表示赞赏。谢谢!
我需要在撇号中打印任何内容
换句话说,您要打印字符串:
for some_tuple in the_list:
for element in some_tuple:
# check if element is a string
if isinstance(element, str):
print(element)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句