I'm trying to use the f.write
keyword, I want each thing I write to be in a new line so I did this:
f.write('',message_variable_from_previous_input,'\n')
However, after I ran this it threw back an error saying the following:
Traceback (most recent call last):
File "c:\Users\User1\OneDrive\Desktop\coding\folder_namr\file_name.py", line 5, in <module>
f.write('',msg,'\n')
TypeError: TextIOWrapper.write() takes exactly one argument (3 given)
Does anybody know haw to fix this?
write
method takes exactly one argument
so you should write like this:
f.write(f"{message_variable_from_previous_input}\n")
or:
f.write(str(message_variable_from_previous_input) + "\n")