Changeset 6555 for trunk


Ignore:
Timestamp:
Jan 5, 2009, 12:12:07 AM (16 years ago)
Author:
roland
Message:

Printed list is now sorted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/exodus/scripts/antenna.py

    r6554 r6555  
    1616    s = (s for s in sections if config.has_option(s, 'antenna') and \
    1717            config.has_option(s, 'gain'))
    18     antenna_list = {}
     18    print_list = []
     19    antenna_dict = {}
     20   
    1921    for i in s:
    2022        antenna = config.get(i, 'antenna')
    2123        gain = config.get(i, 'gain')
    22         ag_string = '%s/%s' % (antenna, gain)
    23         if not antenna_list.has_key(ag_string):
    24             antenna_list[ag_string] = 1
     24        ag_string = '%s--%s' % (antenna, gain)
     25        if not antenna_dict.has_key(ag_string):
     26            antenna_dict[ag_string] = 1
    2527        else:
    26             antenna_list[ag_string] += 1
     28            antenna_dict[ag_string] += 1
    2729
    28     for i in antenna_list:
    29         print "[%s]\t %s" % (antenna_list[i], i)
     30    for i in antenna_dict:
     31        print_list.append(i)
     32
     33    print_list.sort()
     34    for i in print_list:
     35        print "[%s]\t %s" % ( antenna_dict[i], i)
     36       
    3037
    3138if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.