Skip to main content
 首页 » 编程设计

python之将列表转换为python中的字典列表

2025年05月04日9kevingrace

<分区>

我有两个如下所示的 python 列表:

fruits = ["apple", "banana", "guava", "grapes"]   
colour = ["red", "yellow", "green", "black"]   

我希望将它们转换成以下格式的字典:

dictionary = [{"fruit":"apple", "colour":"red"},{"fruit":"banana", "colour":"yellow"}...]