All pastes #768008 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-11-10 05:26 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