从3D列表中删除空格和\ n

时间:2019-07-18 15:57:16

标签: arraylist

我想从列表中删除\ n

l = [[[' NO.  ', ' Product ', ' Brand ', ' Description ', ' EOS Date ', ' List Price (USD)', 'Our Price'], ['1', '\n C9200-24P-A\n', 'CISCO', 'Catalyst 9200 24-port PoE+, Network Advantage', '\n', '$ 3080.00', '\n\n$2,646.00 (14% off)\n\n\n'], ['2', '\n C9200-24T-A\n', 'CISCO', 'Catalyst 9200 24-port data only, Network Advantage', '\n', '$ 2480.00', '\n\n$2,117.00 (15% off)\n\n\n']]]

尝试

new_l = filter(lambda x:re.findall('^[a-zA-Z0-9]+$', x), l)
print(new_l)
<filter object at 0x05F2DE90>

尝试

map(str.strip,l)
<map object at 0x05FF4C50>

0 个答案:

没有答案