newbie write to file question

2005-12-03 Thread ProvoWallis
Hi, I'm trying to create a script that will search an SGML file for the numbers and titles of the hierarchical elements (section level headings) and create a dictionary with the section number as the key and the title as the value. I've managed to make some progress but I'd like to get some gener

Re: newbie write to file question

2005-12-04 Thread Rob E
> I'm not sure what I'm > missing so I'd appreciate some advice. You question is pretty general and I'm not going to go over this in any great detail, but I will make a few comments. * In your if section use if ... else constructs not all the strange if and then not if blocks. Also get rid

Re: newbie write to file question

2005-12-04 Thread Scott David Daniels
ProvoWallis wrote: ... > for root, dirs, files in os.walk(setpath): > fname = files > for fname in files: > inputFile = file(os.path.join(root,fname), 'r') > while 1: >lines = inputFile.readlines(1) >if not lines: >