Python 3.x 有没有办法缩短列表分拣机?

Python 3.x 有没有办法缩短列表分拣机?,python-3.x,Python 3.x,我想输入5个名字,然后手动排序 有没有比这更短的解决方案 在python中,您可以执行以下操作: L = input("Enter names separated by space: ") L = L.split(",") # sort the list L.sort() L = input("Enter names separated by space: ") L = L.split(",") # sort the list L.sort()

我想输入5个名字,然后手动排序

有没有比这更短的解决方案

在python中,您可以执行以下操作:

L =  input("Enter names separated by space: ")
L =   L.split(",")
# sort the list
L.sort()
L =  input("Enter names separated by space: ")
L =   L.split(",")
# sort the list
L.sort()