I know this is probably very easy to do, but I am very new to coding. I can accomplish this in more than one line, but for my assignment it needs to be done in one line.
This is what I have, which raises an error that I don't understand.
trees = open('trees.txt', 'w').write["Tree1", "Tree2", "Tree3"]
TypeError: 'builtin_function_or_method' object is not subscriptable
I imagine that my problem is that I can't just tack on the "write" command where/how I did, but I am lost on how to do this correctly. Thanks in advance for any help or hints!