I want to make a list comprehension that stores a specific attribute of several objects and prints them to the screen.
This is what I tried:
class TextBox(object):
    def __init__(self, text=""):
        self.text = text
// imagine there are several TextBox objects in this list
textContainer = []
print([i.text for i.text in textContainer])
However, this throws NameError: name 'i' is not defined. Is it possible for me to print all of the text attributes without having to do a for loop like this?
for i in textContainer:
    print(i.text)
 
     
    