'Is there any way to get access to a item in a list in another list in one line of code?
Im trying to access to a item in the list with one line of code, but all I can do is this... Here is my code

Solution 1:[1]
Yes. Just use square brackets. So for a list foo, foo[x] returns the element at index x. This can be chained for nested lists.
foo = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(foo)
# [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(foo[1])
# [4, 5, 6]
print(foo[1][2])
# 6
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Locke |
