Newsgroups: comp.lang.python
From: Roel Schroeven <rschroev_nospam...@fastmail.fm>
Date: Sat, 26 May 2007 11:47:58 GMT
Local: Sat, May 26 2007 9:47 pm
Subject: Re: Newbie: Struggling again 'map'
mosscliffe schreef:
> for x,y in map("N/A", lista, listb): ########## Fails - Can not call a The first argument to map is a function, which is called with the items > 'str' > print "MAP:", x, "<<x y>>", y > def fillwith(fillchars): > for x,y in map(fillwith("N/A"), lista, listb): ########## Fails also - of the argument sequences. If the first argument is None, a default function is used which returns a tuple of the items. In the case that two input sequences are provided: map(None, lista, listb) is equivalent to: def maketuple(a, b): So what you want to do can be done with map like this: def make_fill_missing(fillchars): map(make_fill_missing("N/A"), lista, listb)) -- Roel Schroeven You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||