Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.24 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Python: Reducing memory usage of dictionary
  2. i_love TAB 10
  3. love_you TAB 12
  4.        
  5. loadData(file):
  6.      data = {}
  7.      for line in file:
  8.         first, second = line.split('t')
  9.         data[first] = int(second) #or float(second)
  10.  
  11.      return data