![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.python archiveNeed help removing list elements.
From: <nuffnough@gmail.com>
Date: Sat Apr 29 2006 - 15:08:10 CEST
This is python 2.4.3 on WinXP under PythonWin.
I have a config file with many blank lines and many other lines that I
read the file in, splitlines to make a list, then run a loop that
config_file = open("lines.txt", "rb")
i = len(returned_lines)
for i in range(i):
This blanks out all the lines I don't want. I did originally try 'del
for i in range(i):
del returned_lines[i]
But this gives me "IndexError: list out of range
After much experimentation and dumping of the list, I have figured out
Obviously I can iterate over it time and again, but that isn't how the
Is this something obvious that I am doing wrong, or something more
Any help will be gratefully appreciated!
|