little programming probleme

Jonas Geiregat kemu at sdf-eu.org
Wed Mar 12 16:49:40 EST 2003


I have a string and I want to delete all comments , comments start with a #

here is my code
conf is my string where I want to delete comments I think the probleme 
is that if he finds a comment he delete's the element of the list but 
then he can't loop true that element anymore so I should break the loop 
and start the first one again but I don't know how if it could be any 
help I added my error code un the code


chunk = string.split(conf,"\n")
                 for i in range(len(chunk)):
                         for x in range(len(chunk[i])):
                                 if chunk[i][x] == "#":
                                         print chunk[i]












     for x in range(len(chunk[i])):
IndexError: list index out of range


regards Jonas





More information about the Python-list mailing list