python - TypeError, When calculating variables from a dictionary -
what type val_dict.get(filename)[1]
? keep getting typeerror, telling me nonetype:
typeerror: unsupported operand type(s) *: 'float' , 'nonetype'
when try run script line :
water = (float(x1[count]) * (val_dict.get(filename[1]))
i keep getting errors. i've tried calling float
, int
, str
, didn't help.
i've written script import values excel-spreadsheet , scale them. after script supposed extract these values new excel spreadsheet, , thought easiest way storing data in dictionary looks this:
val_dict[filename] = [model, lenghtvalue, dispvalue, froudemax, froudemin] return val_dict val_dict = locate_vals() print val_dict #output: {'c:/eclipse/tst-folder\\test spreadsheet model 151b wl3.xls': [u'm151b', 14.89128, 316.29, 1.0, 0.4041900066850382], 'c:/eclipse/tst-folder\\foldera\\test spreadsheet model 151 wl1 lastet.xls': [u'm151', 14.672460000000001, 316.28887, 1.0, 0.4041900066850382]}
in case interesting, x1-list's output looks this:
[0.35714285714285715, 0.35714285714285715] [1.5845602477694463e-07, 1.5845602477694463e-07]
the issue line:
water = (float(x1[count]) * (val_dict.get(filename[1]))
which should be:
water = (float(x1[count]) * (val_dict.get(filename)[1]))
Comments
Post a Comment