我有一个字符串final line
为
['0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.070802847389,0.0,0.0,', '0.0,0.0,0.169140135429,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,', '0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0261263917462,0.0,0.0,0.0,0.0,0.0,0.0,0.0261263917462,0.0,0.0,0.0,0.0,0.0,0.0,', '0.0961428138228,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,', '']
我必须从字符串中删除最后一个不可打印的数据''
。
答案 0 :(得分:0)
假设您的列表名为final_line
,
final_line.remove('')
应从列表中删除''
答案 1 :(得分:0)
在这种情况下,您可以使用
list_name.remove('')。 如果要从列表中删除最后一个元素:
list_name = list_name[:-1]
或
list_name.pop()