Reputation: 161
Not sure how to fix this? I know little about .format, and I am using:
printedxrows = [ ("[X]","[X]","[X]","[X]","[X]"," <- V: {} TOTAL: {}")
.format(row.count(0), sum(row))
for row in rows ]
I am getting this error:
for row in rows ]
AttributeError: 'tuple' object has no attribute 'format'
Upvotes: 1
Views: 1383
Reputation: 1123970
("[X]","[X]","[X]","[X]","[X]"," <- V: {} TOTAL: {}")
is a tuple, not a string.
You want to call str.format()
on the last element here, which is a string object:
("[X]", "[X]", "[X]", "[X]", "[X]", " <- V: {} TOTAL: {}".format(row.count(0), sum(row)))
Upvotes: 1