python 去除列表中的 “空/换行“ 字符串该列表中有空格和换行以及回车
l = [‘’, ‘You why like this\n’, ‘’, ’ \r\n’, ‘Why are you so\n’, ‘’]写法一:????for x in l:if x.strip():print(x.strip())写法二:????list = [x.strip() for x in l if x.strip()]print(list)‘’’输出的结果为:[‘You why like this’, ‘Why are you so’]‘’’首先用for循环遍历列表l,接着调用st