怎么把列表里的每一个元素换行符去掉
exclude=[]
with open('热点概念备份.txt','r',encoding='UTF-8') as temp:
a = list(temp)
temp.close()
exclude.append(a)
print (exclude)
怎么把列表里的换行符去掉...如下[['白酒\n', '数字货币\n', '商汤概念\n', '远程办公\n', 'UWB概念\n', '航母概念\n', '通用航空\n', '汽车拆解\n', 'GDR概念\n', '生物识别\n', '大飞机\n', '天基互联\n', '蚂蚁概念\n', '地热能\n', '网络安全\n', '无人机\n', '3D摄像头\n', '深证100R\n', '尾气治理\n', '传感器\n', '代糖概念\n', '\n','中国国航']] 这样试试?
exclude=[]
with open('热点概念备份.txt','r',encoding='UTF-8') as temp:
a = list(temp)
temp.close()
exclude.append(a)
exclude =
print(exclude)
在你的程序后面添加一行代码就可以了
exclude = ]
print(exclude) zltzlt 发表于 2020-8-15 11:22
这样试试?
AttributeError: 'list' object has no attribute 'rstrip'
页:
[1]