May-02-2019, 04:38 AM
Is file already existing and have content? If existing and with content - do you want to write it to new line or at the end of existing line?
One way to write (append) to file:
One way to write (append) to file:
>>> my_variable = 'This is the text content.' >>> with open('my_variable.txt', 'a') as f: ... f.write(my_variable)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.