小编Act*_*i67的帖子

Python - 按字母顺序排列嵌套列表

我有以下列表:

["stephane", "philippe", "hélène", ["hugo", "jean-michel", "fernand"], "gustave"]
Run Code Online (Sandbox Code Playgroud)

我想这样订购:

["gustave", "hélène", ["fernand", "hugo", "jean-michel"], "philippe", "stephane"]
Run Code Online (Sandbox Code Playgroud)

注意:如果用户后面有嵌套列表,则此列表必须位于此用户的右侧.

除此之外,所有嵌套列表的工作方式都相同.这是递归的.

python nested list sorted alphabetical

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

标签 统计

alphabetical ×1

list ×1

nested ×1

python ×1

sorted ×1