Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Newbie: Struggling again 'map'
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dan Bishop  
View profile  
 More options May 26 2007, 8:21 pm
Newsgroups: comp.lang.python
From: Dan Bishop <danb...@yahoo.com>
Date: 26 May 2007 03:21:16 -0700
Local: Sat, May 26 2007 8:21 pm
Subject: Re: Newbie: Struggling again 'map'
On May 26, 4:54 am, mosscliffe <mcl.off...@googlemail.com> wrote:

> I thought I had the difference between 'zip' and 'map' sorted but when
> I try to fill missing entries with something other than 'None'. I do
> not seem to be able to get it to work - any pointers appreciated.

> Richard

> lista = ['a1', 'a2']
> listb = ['b10', 'b11','b12' ,'b13']

> for x,y in zip(lista, listb):    #  Fine Truncates as expected
>     print "ZIP:", x, "<<x  y>>", y

> for x,y in map(None, lista, listb):  #  Also fine - extends as
> expected
>     print "MAP:", x, "<<x  y>>", y

> for x,y in map("N/A", lista, listb): ########## Fails - Can not call a
> 'str'
>     print "MAP:", x, "<<x  y>>", y

> def fillwith(fillchars):
>     return fillchars

> for x,y in map(fillwith("N/A"), lista, listb): ########## Fails also -
> Can not call a 'str'
>     print "MAP:", x, "<<x  y>>", y

zip(lista + ['N/A'] * 2, listb)

    Reply to author    Forward  
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.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google