颠倒字典顺序python

2024-09-29 21:54:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个python字典,如下所示:

DictValue = {
'Event1': {},
'Event2': {
    'copy3': {
        'SourcePath': 'souce3',
        'DestPath': 'dest3',
        'Platform': u 'Debug|Win32'
    },
    'copy2': {
        'SourcePath': 'souce3',
        'DestPath': 'dest2',
        'Platform': u 'Debug|Win32'
    },
    'copy1': {
        'SourcePath': 'souce1',
        'DestPath': 'dest1',
        'Platform': u 'Debug|x64'
    },
    'copy5': {
        'SourcePath': 'souce5',
        'DestPath': 'dest5',
        'Platform': u 'Release|Win32'
    },
    'copy4': {
        'SourcePath': 'souce4',
        'DestPath': 'dest4',
        'Platform': u 'Release|x64'
    }
}
}

我想对字典值进行排序,使其看起来像

^{pr2}$

有可能吗?请帮忙。我正在使用python 2.6

谢谢。在


Tags: debugrelease字典platformwin32x64event1event2

热门问题