All pastes #768006 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-11-10 05:21 UTC
rendered paste body
def file_to_dictionary(file):
            lines = {}
            i = 1        
            for x in read_file(file):
                        temp = ''
                        temp_list = []
                        for y in x:         
                                    try:
                                                if float(y):
                                                            value = float(y.strip())
                                                            temp_list.append('%02g'%value)
                                                            i += 1
                                                            if i == 6:
                                                                        lines [temp] = temp_list
                                                                        i += 1
                                                            except ValueError:
                                                                        if i == 7 and (y == "US" or y == "INT"):
                                                                                    lines [temp] = y
                                                                        else:
                                                                                    temp = y                
    return lines