Project

General

Profile

« Previous | Next » 

Revision 733

Added new library maps.py for map spreadsheet manipulation

View differences:

lib/maps.py
1
# Map spreadsheet manipulation
2

  
3
def merge_rows(*rows):
4
    '''e.g. ['a','b'] + ['','y','z'] = ['a','b; y','z']'''
5
    def get(row, i):
6
        try: return row[i]
7
        except IndexError: return ''
8
    return ['; '.join(filter(lambda v: v != '', [get(row, i) for row in rows]))
9
    for i in xrange(max(map(len, rows)))]

Also available in: Unified diff