【发布时间】:2019-09-24 00:37:56
【问题描述】:
我有一个如下所示的列表:
['PSHELL 102 156800 1.55 156800 1. 156800\n',
'PSHELL 103 143120 1.55 143120 1. 143120\n',
'PSHELL 104 143120 1.55 143120 1. 143120\n',
'PSHELL 105 114700 0.7 114700 1. 114700\n',
'PSHELL 106 114700 0.7 114700 1. 114700\n',
'PSHELL 107 114700 1.3 114700 1. 114700\n']
我想删除列表中每个元素的最后三个字符串。并用不同的值填充它。
例如:删除 156800 1. 156800\n 并且对每个元素都以相同的方式。并在那里添加新值。
我期待以下结果:
['PSHELL 102 156800 1.55 1.085 2.015
'PSHELL 103....]
Here 1.085= 1.55-(1.55 x 0.3)
2.015= 1.55+(1.55 x 0.3)
I tried achieving this by converting my list to dataframe, but it is not allowing me to do above math calculation.
【问题讨论】:
-
您能否提供您尝试尝试解决此问题的代码?