I have a list problem in python.
here are simple codes:
x = [scipy.poly1d([ 1., 0., 0.]),2,3,4,5,'foward']
for i in range (len(x)) :
if x [i] == 'foward':
print 'check!'
when it starts, it will say:
return NX.alltrue (self.coeffs == other.coeffs) AttributeError: object 'str' does not have attribute 'coeffs'
but when i change x to:
x = [1,2,3,4,5,'foward']
the program will not work.
can someone explain to me why? What should I do? in fact, I have a list of data fixes (x) that return an attribute error, as mentioned above, and I don’t want to change its format and what it contains.
source
share