访问上一个列表的元素以获取嵌套在python字典中的列表

时间:2019-07-03 02:03:01

标签: python dictionary

我在建立工人累计工资方面遇到问题,但其中包括以下日期:

days =  {'day1':["A","B","date1"],
        'day2':["C","D","date2"],
        'day3':["E","F","date3"],
        'day4':["G","H","date4"],
        'day5':["I","J","date5"]
       }

我已经尝试了一些枚举,但实际上我知道我离实现想要实现的目标还很遥远:

days =
{ 'day1':[["A", "B", date1]],    # data for the first day
  'day2':[["C", "D", date2],["A", "B",date2-date1]], # the day contain its data but also the previous cumulative data and time elapsed from that day
  'day3':[["E", "F", date3],["A", "B",date3-date1],["C", "D",date3-date2]]
  'day4':[["G", "H", date4],["A", "B",date4-date1],["C", "D",date4-date2],["E", "F",date4-date3]]
  'day5':[["I", "J", date5],["A", "B",date5-date1],["C", "D",date5-date2],["E", "F",date5-date3],["G", "H",date5-date4]]
       }

,依此类推。 关于如何进行的任何线索?

0 个答案:

没有答案