Hi, Consider the following please: (re_section, re_name, etc are previously compiled patterns)
result1 = re_section.search(line); result2 = re_name.search(line); result3 = re_data1.search(line); result4 = re_data2.search(line); if result1: last_section = result1.group()[18:-5] elif result2: last_name = result2.group(0)[6:-1] elif result3: data[last_section] = {last_name: result3.group()[13:-5]} elif result4: data[last_section] = {last_name: result4.group()[17:-5]} It gets my goat to have to obtain all resultx when I just want the first that is not None. (In theory, the number of results can be much longer.) I can think of alternatives (raising exceptions), but they all use deep indenting. Ideas? Ed
-- http://mail.python.org/mailman/listinfo/python-list