requestion regarding regular expression
BartlebyScrivener
rpdooling at gmail.com
Fri Apr 14 12:18:58 EDT 2006
That's it. Thank you! Very instructive.
Final:
path = "d:/emacs files/emacsinit.txt"
lines = open(path).readlines()
# next two lines all on one
starts = [i for i, line in enumerate(lines) if
line.startswith('(defun')]
for i, start in enumerate(starts):
while start > 0 and lines[start-1].startswith(';'):
starts[i] = start = start-1
print starts
More information about the Python-list
mailing list