【发布时间】:2015-08-27 08:30:56
【问题描述】:
当我尝试运行这段代码时,我得到了这些错误
Traceback (most recent call last):
File "txt_square.py", line 7, in <module>`enter code here`
sqr = [elem **2 for elem in sqr_lst]
TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'
import csv
import math
with open('/home/amankumar/test.csv', 'rb') as fl:
reader = csv.reader(fl)
sqr_lst = list(reader)
sqr = [elem **2 for elem in sqr_lst]
print sqr
【问题讨论】: