我需要一个快速完成的任务需要一些帮助。在
我有一本字典,里面有下列值的子集。。。在{249863: [1, 'Sr. Financial Analyst'], 180241: [1, 'C# .NET Developer - SQL/Databases, Visual Studio 2010, WPF'], 981011: [1, 'Sr. Business Systems Analyst'], 581669: [1, 'Pharmaceutical Sales - Intern'], 641064: [1, 'Software Engineer II -'], 708653: [1, ' Sports Minded Consultant - Sales - Management - Entry Level'], 41011: [1, 'Regional Revenue Manager- West Coast'], 81979: [1, 'Assistant Buyer'], 401479: [2, 'Valve Technician'], 876619: [1, 'Manufacturing Engineer'],
字典的结构键是:ID Number,值:Count,Title
我需要整理这本字典,并根据计数打印前5个键。在
目前,我已经想出了这个代码,但它似乎不能满足我的需要:
^{pr2}$
当前问题2打印:{627329: [1, 'Young Professionals Customer Relations'], 547457: [1, 'iPhone/Android/Mobile OS Apps Developer'], 520659: [1, 'technician/receptionist'], 178789: [2, 'Business Planning Analyst'], 401479: [2, 'Valve Technician']}
但正如你所看到的,它首先打印了一些1。在
提前感谢大家的帮助!,请记住,我需要让它为python2.4而不是2.7:(Constraint)工作。在
在Python2.4环境下,用户需要对一个字典进行操作,该字典包含IDNumber作为键和Count与Title作为值。目标是根据Count的值打印前5个最大的键。用户提供的代码未能按预期过滤出Count为1的条目。问题在于需要对字典进行排序并仅显示Count最大的前五个键。
9万+

被折叠的 条评论
为什么被折叠?



