To start off I know what I 3D array is, but I am having problems acessing the indices of a 3D list in Python.
For example:
The output of the following program is this:
[['This', 'is', 'a', 'awesome'], ['3D', 'list', 'test', '!']]
When what I am looking for it to do is look for four letter words from the 3D list and add them to List2. I am thinking I should be using a inner and outer for loop for the 3D list as it was needed in my previous language I used, but when I tried that I still only got it to search how many items where in the list and not the items of the lists indivdually.
What I am asking is how does one search individual items in a list of a list instead of just looking at the list as a whole.
For example:
Code:
List1 = [['This', 'is', 'a', 'awesome'], ['3D', 'list', 'test', '!']]
List2 = []
for index in List1:
if len(index) == 4:
List2.append(index)
print List2
The output of the following program is this:
[['This', 'is', 'a', 'awesome'], ['3D', 'list', 'test', '!']]
When what I am looking for it to do is look for four letter words from the 3D list and add them to List2. I am thinking I should be using a inner and outer for loop for the 3D list as it was needed in my previous language I used, but when I tried that I still only got it to search how many items where in the list and not the items of the lists indivdually.
What I am asking is how does one search individual items in a list of a list instead of just looking at the list as a whole.






