python 按从小到大的顺序组合成一个字典_如何将两个列表按顺序组合成字典?...

我试图将两个列表的值合并到一个字典集中,但是在组合字典后,键和值不是按列表中的原始顺序排列的,它将与随机键和值配对,所以我如何按顺序组合它们?参见以下输入和输出:data_ids = ['22630876', '22626950', '22624826', '22626159', '22616496', '22601480', '22611197', '22600498', '22605808', '22602601', '22602543', '22594071', '22595982', '22593725', '22591441', '22553315', '22584758']

tag_ids = ['WATCH - Stokes faces unpredictable balls', "'Bad position, but we're not out of it' - de Villiers", 'Who is Sandeep Lamichhane?', 'WATCH - All the action from the Super Over', "WATCH - Sammy's four-ball blitz", "Shubman Gill's red-hot run streak", 'Should bowlers start wearing helmets?', 'Keshav Maharaj could be key - Graeme Smith', "WATCH - Kevin Pietersen's match-winning 48", "'It was emotional walking off the pitch' - Stokes", "WATCH - India's gains from the South Africa tour", 'WATCH - Best of Kohli in South Africa', 'The Ashwin-Gibbs exchange: funny, or not?', "Mayank Agarwal's incredible run of domestic form", "'SA can't afford spicy pitches against Australia'", 'Ice Cricket: Legends play T20 in the Alps', 'Dhoni, Kohli and quirky on-field chatter']

z = dict(zip(data_ids,tag_ids))

print(z)

{'22595982': 'The Ashwin-Gibbs exchange: funny, or not?', '22593725': "Mayank Agarwal's incredible run of domestic form", '22626159': 'WATCH - All the action from the Super Over', '22553315': 'Ice Cricket: Legends play T20 in the Alps', '22626950': "'Bad position, but we're not out of it' - de Villiers", '22624826': 'Who is Sandeep Lamichhane?', '22611197': 'Should bowlers start wearing helmets?', '22630876': 'WATCH - Stokes faces unpredictable balls', '22600498': 'Keshav Maharaj could be key - Graeme Smith', '22602601': "'It was emotional walking off the pitch' - Stokes", '22602543': "WATCH - India's gains from the South Africa tour", '22591441': "'SA can't afford spicy pitches against Australia'", '22601480': "Shubman Gill's red-hot run streak", '22594071': 'WATCH - Best of Kohli in South Africa', '22605808': "WATCH - Kevin Pietersen's match-winning 48", '22584758': 'Dhoni, Kohli and quirky on-field chatter', '22616496': "WATCH - Sammy's four-ball blitz"}

如您所见,z的输出以键值'22595982'开头,但它应该是'22630876',即使字典的值也是一样,我怎么能做到这一点,我搜索了类似的问题,但没有找到任何问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值