requestion regarding regular expression
BartlebyScrivener
rpdooling at gmail.com
Fri Apr 14 10:47:17 EDT 2006
Kent,
Running
path = "d:/emacs files/emacsinit.txt"
lines = open(path).readlines()
# my defun lines are lowercase,
# next two lines are all on one
starts = [i for i, line in enumerate(lines) if
line.startswith('(defun')]
for i, start in starts:
while start > 0 and lines[start-1].startswith(';'):
starts[i] = start = start-1
print starts
I get
File "D:\Python\findlines.py", line 7, in __main__
for i, start in starts:
TypeError: unpack non-sequence
Also, I don't understand the "i for i", but I don't understand a lot of
things yet :)
thanks,
rick
More information about the Python-list
mailing list