On 06/02/18 21:07, Hüseyin Ertuğrul wrote: > "hMailServer SpamProtection rejected RCPT (Sender: > valeria0...@mikelsonconstruction.com, IP:187.62.63.218, Reason: Rejected by > Spamhaus.)" > "hMailServer SpamProtection rejected RCPT (Sender: veronika07...@etb.net.co, > IP:190.25.189.74, Reason: Rejected by SpamCop.)" > "hMailServer SpamProtection rejected RCPT (Sender: > sofia...@pembroketownhouse.ie, IP:103.247.48.95, Reason: Rejected by > Spamhaus.)" > > Traceback (most recent call last): > File "C:/Depo/Python/prj1/analiz.py", line 17, in <module> > prnt(deger) > File "C:/Depo/Python/prj1/analiz.py", line 7, in prnt > iplist = list_line[1] > IndexError: list index out of range)
So you have a line with no commas in it. Have you checked the line that causes the error - presumably right after the last one that printed correctly. > ------------------------------------------------------------------------------- > My code is below; > def prnt(L1): > > L1 = L1[:-1] > > list_line = L1.split(",") You are splitting by comma but I notice the IP addresses all start with IP: so it might be easier/more reliable to split by 'IP:' in case there are other messages with commas but no IP addresses in them? But even so you still need to either check the result length or use a try/except IndexError to deal with malformed lines. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor