我目前正在构建一段代码,该代码从我正在使用的数据源提供的元组中组合业务对象。由于这些元组的长度和命名可能不同,因此我想在for循环中插入一个预定义的元组。for class_attributes in answer:
# I would want to access them dynamically in here, instead Pythonis using "class_attributes"
我试图更深入地理解for是如何在Python语言中针对不同的数据类型进行循环的。使用for循环迭代数组的最简单方法是 do_something(array[i])for i in array:do_something(i)for i, j in range(len(array)):
# What is