I'm stuck with the following. I seem to be doing something wrong while appending. I receive the error: 'float' object has no attribute 'append'. I understand now I'm appending a float value, which isn't possible. But how can I get for example in TheorBlockNeighborsOne in each list on the first index the value of index [0] of Data_BM_Sorted_List, and in each list on the second spot the value of index 1 from Data_BM_Sorted_List and on the third spot the value of Data_BM_Sorted_List at index 2. And then for each i.
TheorBlockNeighborsOne[i] = Data_BM_Sorted_List[i][0]
TheorBlockNeighborsOne[i].append((Data_BM_Sorted_List[i][1]+Horizontal_Block_Dimensions))
TheorBlockNeighborsOne[i].append((Data_BM_Sorted_List[i][2]))
Horizontal_Block_Dimensions = int(raw_input())
The Raw Input for Horizontal_Block_Dimensions is 100
Data_BM_Sorted_List = [[336350.0, 7089650.0, -7.0, 0.1665, 1.5, 1], [336350.0, 7089650.0, -5.0, 0.1542, 1.5, 1], [336350.0, 7089650.0, -3.0, 0.2259, 1.5, 1], [336350.0, 7089650.0, -1.0, 0.2753, 1.5, 1], [336350.0, 7089650.0, 1.0, 0.2236, 1.5, 1], [336450.0, 7089550.0, -7.0, 0.1791, 1.5, 2], [336450.0, 7089550.0, -5.0, 0.1707, 1.5, 2], [336450.0, 7089550.0, -3.0, 0.2248, 1.5, 2], [336450.0, 7089550.0, -1.0, 0.2791, 1.5, 2], [336450.0, 7089550.0, 1.0, 0.3098, 1.5, 2], [336450.0, 7089650.0, -5.0, 0.1488, 1.5, 3], [336450.0, 7089650.0, -3.0, 0.1961, 1.5, 3], [336450.0, 7089650.0, -1.0, 0.2499, 1.5, 3], [336450.0, 7089650.0, 1.0, 0.2939, 1.5, 3], [336550.0, 7089350.0, -7.0, 0.1774, 1.5, 4], [336550.0, 7089350.0, -5.0, 0.2551, 1.5, 4], [336550.0, 7089350.0, -3.0, 0.3489, 1.5, 4], [336550.0, 7089350.0, -1.0, 0.3707, 1.5, 4], [336550.0, 7089350.0, 1.0, 0.3037, 1.5, 4], [336550.0, 7089450.0, -5.0, 0.1719, 1.5, 5], [336550.0, 7089450.0, -3.0, 0.3121, 1.5, 5], [336550.0, 7089450.0, -1.0, 0.3491, 1.5, 5], [336550.0, 7089450.0, 1.0, 0.326, 1.5, 5], [336550.0, 7089550.0, -7.0, 0.1494, 1.5, 6], [336550.0, 7089550.0, -5.0, 0.1598, 1.5, 6], [336550.0, 7089550.0, -3.0, 0.2061, 1.5, 6], [336550.0, 7089550.0, -1.0, 0.2554, 1.5, 6], [336550.0, 7089550.0, 1.0, 0.3218, 1.5, 6], [336550.0, 7089650.0, -5.0, 0.1334, 1.5, 7], [336550.0, 7089650.0, -3.0, 0.1711, 1.5, 7], [336550.0, 7089650.0, -1.0, 0.193, 1.5, 7], [336550.0, 7089650.0, 1.0, 0.2498, 1.5, 7], [336650.0, 7089150.0, -9.0, 0.165, 1.5, 8], [336650.0, 7089150.0, -7.0, 0.1791, 1.5, 8], [336650.0, 7089150.0, -5.0, 0.2482, 1.5, 8], [336650.0, 7089150.0, -3.0, 0.3541, 1.5, 8]]
TheorBlockNeighborsOne = [[]]*len(Data_BM_Sorted_List)
TheorBlockNeighborsTwo = [[]]*len(Data_BM_Sorted_List)
TheorBlockNeighborsThree = [[]]*len(Data_BM_Sorted_List)
TheorBlockNeighborsFour = [[]]*len(Data_BM_Sorted_List)
TheorBlockNeighborsFive = [[]]*len(Data_BM_Sorted_List)
TheorBlockNeighborsSix = [[]]*len(Data_BM_Sorted_List)
TheorBlockNeighborsSeven = [[]]*len(Data_BM_Sorted_List)
TheorBlockNeighborsEight = [[]]*len(Data_BM_Sorted_List)
# BlockNeighborsX = [[X,Y,Z]]
for i in range(0,len(TheorBlockNeighborsOne)):
TheorBlockNeighborsOne[i] = Data_BM_Sorted_List[i][0]
TheorBlockNeighborsOne[i].append((Data_BM_Sorted_List[i][1]+Horizontal_Block_Dimensions))
TheorBlockNeighborsOne[i].append((Data_BM_Sorted_List[i][2]))
TheorBlockNeighborsTwo[i] = Data_BM_Sorted_List[i][0] + Horizontal_Block_Dimensions
TheorBlockNeighborsTwo[i].append(Data_BM_Sorted_List[i][1])
TheorBlockNeighborsTwo[i].append(Data_BM_Sorted_List[i][2])
TheorBlockNeighborsThree[i] = Data_BM_Sorted_List[i][0]
TheorBlockNeighborsThree[i].append(Data_BM_Sorted_List[i][1] - Horizontal_Block_Dimensions)
TheorBlockNeighborsThree[i].append(Data_BM_Sorted_List[i][2])
TheorBlockNeighborsFour[i] = Data_BM_Sorted_List[i][0] - Horizontal_Block_Dimensions
TheorBlockNeighborsFour[i].append(Data_BM_Sorted_List[i][1])
TheorBlockNeighborsFour[i].append(Data_BM_Sorted_List[i][2])
TheorBlockNeighborsFive[i] = Data_BM_Sorted_List[i][0] - Horizontal_Block_Dimensions
TheorBlockNeighborsFive[i].append(Data_BM_Sorted_List[i][1] + Horizontal_Block_Dimensions)
TheorBlockNeighborsFive[i].append(Data_BM_Sorted_List[i][2])
TheorBlockNeighborsSix[i] = Data_BM_Sorted_List[i][0] + Horizontal_Block_Dimensions
TheorBlockNeighborsSix[i].append(Data_BM_Sorted_List[i][1] + Horizontal_Block_Dimensions)
TheorBlockNeighborsSix[i].append(Data_BM_Sorted_List[i][2])
TheorBlockNeighborsSeven[i] = Data_BM_Sorted_List[i][0] + Horizontal_Block_Dimensions
TheorBlockNeighborsSeven[i].append(Data_BM_Sorted_List[i][1] - Horizontal_Block_Dimensions)
TheorBlockNeighborsSeven[i].append(Data_BM_Sorted_List[i][2])
TheorBlockNeighborsEight[i] = Data_BM_Sorted_List[i][0] - Horizontal_Block_Dimensions
TheorBlockNeighborsEight[i].append(Data_BM_Sorted_List[i][1] - Horizontal_Block_Dimensions)
TheorBlockNeighborsEight[i].append(Data_BM_Sorted_List[i][2])
print TheorBlockNeighborsOne
The error I get:
AttributeError Traceback (most recent call last)
<ipython-input-46-a2f61fb09e5b> in <module>()
12 for i in range(0,len(TheorBlockNeighborsOne)):
13 TheorBlockNeighborsOne[i] = Data_BM_Sorted_List[i][0]
---> 14 TheorBlockNeighborsOne[i].append((Data_BM_Sorted_List[i][1]+Horizontal_Block_Dimensions))
15 TheorBlockNeighborsOne[i].append((Data_BM_Sorted_List[i][2]))
16 TheorBlockNeighborsTwo[i] = Data_BM_Sorted_List[i][0] + Horizontal_Block_Dimensions
AttributeError: 'float' object has no attribute 'append'