append modifies the list and returns nothing by itself.
So it will be right:
my_list = ['1', '2', 'a'] with open('items.txt', 'w') as f: f.write(', '.join(my_list)) with open('items.txt', 'r') as f: text = f.read() new_list = text.split(', ') print(new_list) # ['1', '2', 'a']
Slightly more
It is better to work with files through with , so that they are automatically closed and you do not have to call the close method yourself.
You need to understand what type of new in your example:
type(new) # <type 'file'>`
Accordingly, iteration over new will return file lines, rather than individual characters. However, the code from the question would not work in the opposite case, since spaces and commas are no worse than letters and numbers from the point of view of Python. We would get a list:
['1', ',', ' ', '2', ',', ' ', 'a']
Well, the list in Python is a variable data structure, append adds an element to the list and does not return anything (more precisely, it returns None, which you successfully print to the screen).