mapping the read() fonction

Grant Edwards ge at nowhere.none
Mon Jul 24 13:29:49 EDT 2000


In article <8lhsu5$huv$1 at reda.worldonline.fr>, Benjamin wrote:

>I would like to map the read() function of a file object
>
>I have a list of file objects. I want to return the list of their content
>using the map function
[...]

How about:

  names = ['a','b','c']
  list1 = map(open,names,['r','r','r'])
  print list1
  list2 = map(lambda f: f.read(), list1)
  print list2

-- 
Grant Edwards                   grante             Yow!  Everybody is going
                                  at               somewhere!! It's probably
                               visi.com            a garage sale or a disaster
                                                   Movie!!



More information about the Python-list mailing list