Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 不支持的列表类型错误:/:';列表';和';浮动';_Python_Python 3.x_List - Fatal编程技术网

Python 不支持的列表类型错误:/:';列表';和';浮动';

Python 不支持的列表类型错误:/:';列表';和';浮动';,python,python-3.x,list,Python,Python 3.x,List,我有下面的代码 def latency(i): layer_macc = profile(model) #new_list=[float(i) for i in layer_macc] macc_layer=layer_macc[i] return macc_layer/(3.84*pow(10,11)) 当我试着运行代码时,我发现下面的错误 TypeError: unsupported operand type(s) for /: 'list' and 'float'

我有下面的代码

def latency(i):
   layer_macc = profile(model)
   #new_list=[float(i) for i in layer_macc]
   macc_layer=layer_macc[i]
   return macc_layer/(3.84*pow(10,11))
当我试着运行代码时,我发现下面的错误

TypeError: unsupported operand type(s) for /: 'list' and 'float'. 
我试图将列表转换为float,但仍然不起作用


谢谢

替换最后两行:

x=3.8*pow(10,11)
return [f/x for f in macc_layer]

你认为将
列表
除以
浮点数
应该做什么?您希望将
列表
转换为
浮动
会是什么?