Here's an example of my current output:
['5216', 'SMITH', 'VICTORIA', 'F', '2009-12-19']
This is my code:
users1 = open('users1.txt','w')
with open('users.txt', 'r') as f:
data = f.readlines()
for line in data:
words = str(line.split())
#print words
f.seek(0)
users1.write(words)
I would like to read in users.txt and separate the information to send it to users1 and another text file I'll call users2. (Keep in mind this is a hypothetical situation and that I acknowledge it would not make sense to separate this information like I'm suggesting below.)
Is it possible to identify specific columns I'd like to insert into each text file?
For example, if I wanted users1.txt to contain, using my sample output from above, ['5216','2009-12-19'] and users2.txt to contain ['SMITH','VICTORIA'], what should I do?