Mar-23-2022, 08:47 AM
Quote of assignment doesn't mention loop. So alternative way could be to skip loop and use
print
(unpack list with*
, set separator to newline, print to file) :words =['walrus','cat','parrot','fish','monkey','giraffe'] def write_list_to_file(list_, filename): with open(filename, "w", encoding="UTF8") as f: print(*list_, sep='\n', file=f) write_list_to_file(words, 'write_list_to_file.txt')
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.