小编Kai*_*etz的帖子

对字典键进行排序,其中键也是字典

我有一个关于如何对这样的字典进行排序的快速问题:

我有的是:

vehicles = {"carA": {"speed": 20, "color": "red"}, "carB": {"speed": 25, "color": "blue"}}
Run Code Online (Sandbox Code Playgroud)

我想要的是一个列表,其中车辆字典按速度的高速排序(carB的速度高于carA的速度,因此carB是列表中的第一个):

vehicles_list = [{"carB": {"speed": 25, color: "blue"}}, {"carA": {"speed": 20, color: "red"}}]
Run Code Online (Sandbox Code Playgroud)

python sorting dictionary python-3.x

4
推荐指数
1
解决办法
96
查看次数

将 Drawer 元素放置在菜单底部

如何将菜单点定位在屏幕的下边缘?最好的解决方案是,如果您可以简单地更改每个元素的导航选项的样式。

这是我的应用程序导航器:

    const AppNavigator = createDrawerNavigator(
      {
        Einkaufsliste: {
          screen: MainScreen,
          navigationOptions: {
            drawerIcon: <Icon name="shopping-cart" />
          }
        },
        Bearbeiten: {
          screen: BasketEditScreen,
          navigationOptions: {
            drawerIcon: <Icon name="edit" />
          }
        }
      },

      {
        contentComponent: CustomDrawerComponent
      }
    );
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

谢谢!

javascript react-native react-navigation

1
推荐指数
1
解决办法
1893
查看次数