creepyzzzzzyq
2019-04-10 19:53求问各位大佬怎么用python获取排序后二维列表在原列表中的下标,我的代码是这样的,但是报错了
g = [0] * len(machine)
for i in machine:
g[i] = [0] * len(time_slot)
for i in machine:
g[i] = c[i]
print(g)
for i in machine:
c[i].sort()
print(c)
cost_index = [0] * len(machine)
for i in machine:
cost_index = [0] * len(time_slot)
for i in machine:
for k in time_slot:
cost_index[i][k] = g[i].index(c[i][k])
print(cost_index)
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- python继承,求各位大佬帮我找个小白看一下我这个bug是什么?求!
- python
- 2个回答
- 有关python的作业,求求各位大佬帮帮忙,很简单的,但是我是前端一点都不会
- python
- 2个回答
- Python 实现一维列表和多维列表组成字典
- python
- 1个回答
- python sorted排序问题
- python
- list
- 2个回答
- Python多进程问题的报错问题
- python
- 1个回答
换一换