def get_a_line(src, number):
 global FILE_CACHE
 if (src not in FILE_CACHE):
  FILE_CACHE[src] = []
  for line in open(src, 'r'):
   FILE_CACHE[src].append(line)
 try:
  return FILE_CACHE[src][(number - 1)]
 except:
  return ''

def get_a_line ( src , number ) : global FILE_CACHE if ( src not in FILE_CACHE ) : FILE_CACHE [ src ] = [ ] for line in open ( src , 'r' ) : FILE_CACHE [ src ] . append ( line ) try : return FILE_CACHE [ src ] [ ( number - 1 ) ] except : return ''
retrieve line number from file src with caching .