On Fri, Jun 11, 2004 at 08:39:46PM -0500, Jay Hannah wrote:
On Jun 10, 2004, at 6:30 AM, Mike Hostetler wrote:
Here is an example of real working code that decodes a list of
Unicode
strings into latin-1:
goodProcRef = map(lambda x: x.decode("latin-1"), goodProcRef)
How do you use that? (Can I get some context code?)
The map function applies a function to every item in a list, returning
of list of the result. You can do the same thing with a for-loop, but
using the map function is much faster.
In Perl, it would be something like:
@decoded = [];
for $p in (@goodProcRef) {
push(@decoded,$p->decode());
}
@goodProcRef=@decoded;