I am fairly new to python, and have been trying to create a program where I create a file from user inputs. However, I cannot seem to get it to work, and keep getting the error:
Traceback (most recent call last):
File "my_program.py", line 7, in <module>
my_file.append(x)
AttributeError: '_io.TextIOWrapper' object has no attribute 'append'
I think this means that I cannot append the file, but I am not sure at all why. Here is the relevant part of my program:
my_file = "my_file"
with open(my_file, 'a') as my_file:
lines = True
counting_variable = 0
while lines:
x = input()
my_file.append(x)
Thank you very much for any help in advance!