Changeset 8633 for main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py
- Timestamp:
- 6 Jun 2012, 01:11:19 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py
r8631 r8633 658 658 This CSV file merging copes with different column orders in both 659 659 CSV files and even with different column sets in both files. 660 661 Also broken/empty CSV files can be handled. 660 662 """ 661 663 # sniff the col names 662 row10 = csv.DictReader(open(path1, 'rb')).next() 663 row20 = csv.DictReader(open(path2, 'rb')).next() 664 try: 665 row10 = csv.DictReader(open(path1, 'rb')).next() 666 except StopIteration: 667 row10 = dict() 668 try: 669 row20 = csv.DictReader(open(path2, 'rb')).next() 670 except StopIteration: 671 row20 = dict() 664 672 fieldnames = sorted(list(set(row10.keys() + row20.keys()))) 665 673 # now read/write the real data
Note: See TracChangeset for help on using the changeset viewer.