SyntaxFix
Write A Post
Hire A Developer
Questions
The pythonic way to read a file and put every lines in a list:
from __future__ import with_statement #for python 2.5 Names = [] with open('C:/path/txtfile.txt', 'r') as f: lines = f.readlines() Names.append(lines.strip())