test = ['', 'ttt\n ', "123"]
test = [x.strip() for x in test if x.strip() != '']
print(test)
Python替换掉列表的\n 和空格
最新推荐文章于 2023-05-26 05:38:28 发布
test = ['', 'ttt\n ', "123"]
test = [x.strip() for x in test if x.strip() != '']
print(test)