Write a List of Items into a Text or CSV File

PHOTO EMBED

Tue Dec 14 2021 09:20:26 GMT+0000 (Coordinated Universal Time)

Saved by @Radhika00

list_to_write = ["Write", "these", "in", "file", "number", 4]
file = open("file4.txt", "w")
file.write(" ".join([str(item) for item in list_to_write]))
file.close()
content_copyCOPY

To write into a file, you must first open it, and then write into it, and close it.

https://www.scaler.com/topics/convert-list-to-string-python/