Python替换掉列表的 和空格 test = ['', 'ttt ', "123"] test = [x.strip() for x in test if x.strip() != ''] print(test)