[Tutor] question

Doug Potter dpotter at nc.rr.com
Sat Nov 4 01:02:01 CET 2006


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
''



More information about the Tutor mailing list