I have to ask the user for an output file and then append data to it but whenever I try it tells me that the data has no append attribute. I think this is because when I try to open the file it is seeing it as a string and not an actual file to append data too. I have tried multiple ways of doing this but right now I am left with this:
Output_File = str(raw_input("Where would you like to save this data? "))
fileObject = open(Output_File, "a")
fileObject.append(Output, '\n')
fileObject.close()
The output that I am trying to append to it is just a list I earlier defined. Any help would be greatly appreciated.
fileObject.write('%s\n' % '\n'.join(str(item) for item in Output))if you want it comma separated but without the brackets it isfileObject.write('%s\n' % ', '.join(str(item) for item in Output)).