0
我想使用行值來獲得C_vel
值。我該如何解決這個問題:TypeError:用於/:'tuple'和'float'的不受支持的操作數類型?
代碼:
wb = op.load_workbook('Canopy\Scripts\De Velliers.xlsx')
ws = wb ['Sheet1']
for row in ws.rows:
for cell in row:
print(cell.value)
print "----------"
C_vel = ws.rows/(A_c * rho)
print "C_vel: ", C_vel
錯誤消息:
TypeError
Traceback (most recent call last)
C:\Users\Fraixxer Fraiz\Canopy\scripts\franis 1.py in <module>()
26 print(cell.value)
27 print "----------"
---> 28 C_vel = ws.rows/(A_c * rho)
29 print "C_vel: ", C_vel
30
TypeError: unsupported operand type(s) for /: 'tuple' and 'float'
'ws.rows'是一個元組,它不能被float [A_c * rho]分隔。在每個循環中打印出來,以便看到發生了什麼。很難再幫助你,因爲我不確定'C_vel'的期望結果是什麼。 – timgeb