问题遇到的现象和发生背景
我2种情况下的代码几乎一样 ,为什么第一个无法运行啊?
```python
import openpyxl
aa = '股票型'
wb = openpyxl.load_workbook('jijin.xlsx')
ws1 = wb[f'{aa}'] # 获取基金类型的工作表
a = []
for cell in ws1['E']:
a.append(cell.value)
del a[0]
a = [float(i) for i in a]
print(a)
问题相关代码,请勿粘贴截图
运行结果及报错内容
TypeError: float() argument must be a string or a number, not 'NoneType'
我的解答思路和尝试过的方法
```python
a = ['2.54', '4.02', '1.16', '1.15', '3.86', '-0.06', '-0.07', '4.31', '3.84', '3.84', '4.30', '0.66', '0.65', '1.99', '1.98', '0.35', '-1.14', '-1.13', '2.59', '1.57', '1.02', '0.98']
del a[0]
a=[float(i) for i in a]
print(a)
我想要达到的结果
[4.02, 1.16, 1.15, 3.86, -0.06, -0.07, 4.31, 3.84, 3.84, 4.3, 0.66, 0.65, 1.99, 1.98, 0.35, -1.14, -1.13, 2.59, 1.57, 1.02, 0.98]