plans_dtype = ["str", "str", "int", "int", "int", "int","int", "int","int", "int", "int", "int","int", "int"]
/ other code/
plans_dtype_dict = {plans_cols[i]:plans_dtype[i] for i in range(0,len(plans_cols))}
plans_dtype_dict
我想创建一个字典,其中我想把plans_cols作为键,把plans_dtype作为它的值。
IndexError Traceback (most recent call last)
Input In [24], in <cell line: 1>()
----> 1 plans_dtype_dict = {plans_cols[i]:plans_dtype[i] for i in range(0,len(plans_cols))}
2 plans_dtype_dict
Input In [24], in <dictcomp>(.0)
----> 1 plans_dtype_dict = {plans_cols[i]:plans_dtype[i] for i in range(0,len(plans_cols))}
2 plans_dtype_dict
IndexError: list index out of range
我试图检查我的代码和它的列表然而,我不明白为什么它给了一个索引错误
1条答案
按热度按时间mbjcgjjk1#
方法1
方法2