Alright so I know you cannot append a tuple to a list. However I am still receiving this error despite my best efforts. Can someone tell me what I am doing wrong or what is going on?
Traceback (most recent call last): File "C:/Users/.py", line 31, in listRow.append(convertedList) AttributeError: 'tuple' object has no attribute 'append'
followedBy is a string that comes from a cursor and is split into a list form. Below is some sample data that the cursor would contain.
followedBy = "0| 1| 2| 40"
table = [] #contains all rows (table)
row = [] #contains row
listFollowedBy = [] #contains ids
for (var1, var2, var3, followedBy) in cursor:
row = var1, var2, var3
listFollowedBy = followedBy.split("| ") #Thought split always split the data into lists
convertedList = list(listFollowedBy) #Threw this in there just to insure it was converted to a list
row.append(convertedList)
table.append(row)
rowis a tuple as defined at the moment (you bind it to a list and then you rebind it to a tuple within yourforsuite). Change torow = [var1, var2, var3]