Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我们可以在Python3中按升序排列列表(input())吗_Python - Fatal编程技术网

我们可以在Python3中按升序排列列表(input())吗

我们可以在Python3中按升序排列列表(input())吗,python,Python,大家好,我用France IOI做练习,但我知道如何像列表一样提升list(input())的值 例如 a = list(int(input())) >>> a = 8 9 2 如果我正确理解你的问题,你可以这样做: a = sorted(map(int, input('Enter the numbers: ').split())) 我认为我们不需要再次调用list到map对象排序(map(int,input('输入数字:')。split())够了吗?对,排序的可以使用任意

大家好,我用France IOI做练习,但我知道如何像列表一样提升
list(input())
的值

例如

a = list(int(input()))
>>> a = 8 9 2

如果我正确理解你的问题,你可以这样做:

a = sorted(map(int, input('Enter the numbers: ').split()))

我认为我们不需要再次调用
list
map
对象<代码>排序(map(int,input('输入数字:')。split())够了吗?对,
排序的
可以使用任意迭代器,但仍然保证返回一个
列表
@ABDULNIYASPM您是对的,谢谢您的注意。