我有3列不同的数据,我正试图组织和打印。excel文件如下所示:
我正在尝试将数据读入Python,我的最终目标是以以下方式打印数据:
Red: tshirt - 32, pants - 16, socks - 1
Blue: flannel - 48, pants - 23, socks - 5
Yellow: tshirt - 12
我将所有列组织到它们自己的列表中,但我无法理解的部分是如何指导我的程序如何组织颜色标题下的项目,因为颜色列只有3个值。例如,我如何告诉程序T恤、裤子和袜子在红色标题下,而T恤在黄色标题下?有没有一种方法可以概括这一点,这样它就可以在相同格式的其他电子表格上读取和排序这些信息
您可以尝试使用^{} 、^{} 和^{} :
输出:
编辑:
使用} :
openpyxl
和^{输出:
相关问题 更多 >
编程相关推荐