题解 | #单词倒排#
单词倒排
https://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836
import re n = input() l = re.split(r'\W+',n) new_list = [] for i in l[::-1]: new_list.append(i) print(' '.join(map(str,new_list)))
导入re库,利用split方法,切分方式为\W+,表示切分所有非字母