Hi Doug, I'm not a Python guru, but shouldn't you be putting the output of file.split('\n') into a list, and not back into a string (for clarity's sake?).
Also, if you have two trailing newlines on the file, your final string will be '', so you should be doing clean1.append(i[26:40]) in your for loop, right? Let me know if that helps... Jonathon Doug Potter wrote: > I don't get the output I would expect from the following. > The variable clean1 gives me an empty string. But if i change the for > loop to print i[26:40] I get all the info. > what do I need to do to capture all the data to clean1? > > Thanks. > > >>> a = open('arp.txt') > >>> file = a.read() > >>> file = file.split('\n') > >>> a.close() > >>> b = open('arplist.txt','w') > >>> clean1 = [] > >>> > >>> for i in file: > ... clean1 = i[26:40] > ... > >>> clean1 > '' > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor