import sysfor array_num in sys.stdin: lines=sys.stdin.readline() a=lines.strip().split(' ') l=[] for i in a: i=int(i) l.append(i) l.sort() o=[str(a) for a in l] print(' '.join(o))
稍微簡化的寫法
from sys import stdin for num in stdin: a = [int(s) for s in stdin.readline().strip().split(' ')] l = [str(n) for n in sorted(a)] print(' '.join(l))