1# Saving the list
2a = ["apple", "banana", 2, 3]
3with open("test.txt", "w") as f:
4 for item in a:
5 f.write("%s\n" % item)
6
7with open("test.txt", "r") as f:
8 print(f.read())
9
10# Converting contents of file into new list
11f = open("test.txt", "r")
12listItems = f.read().splitlines()
13print(listItems)