遍历一个字符串元组列表可以使用循环来实现。以下是一个示例代码:
str_tuple_list = [('apple', 'banana'), ('orange', 'grape'), ('watermelon', 'melon')]
for str_tuple in str_tuple_list:
for string in str_tuple:
print(string)
输出结果:
apple
banana
orange
grape
watermelon
melon
在上面的示例中,我们定义了一个包含字符串元组的列表str_tuple_list
。然后使用两个嵌套的循环来遍历列表中的每个元组和每个元组中的字符串。在每次循环中,将当前字符串打印出来。
下一篇:遍历一个作为表对象的列表。