def read_file(location, chomp=True):
 with open(location) as file_handle:
  contents = file_handle.read()
 if chomp:
  return contents.rstrip('\n')
 else:
  return contents

def read_file ( location , chomp = True ) : with open ( location ) as file_handle : contents = file_handle . read ( ) if chomp : return contents . rstrip ( '\n' ) else : return contents
read file and decode in py2k .