LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-06-2010, 01:33 AM   #1
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,930

Rep: Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110
Convert map(None, list1, list2) from Python 2.x to Python 3.x


I have an existing line of code from a P2 script that I cannot find a solution to converting to P3:

Code:
for i, x in map(None, list1, list2):
I have found the information about converting the simple case:

Quote:
map(None,x) becomes list(x)
But my googling was unable to find a solution when more than one iterable exists

Cheers in advance
 
Old 04-06-2010, 08:10 AM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,703

Rep: Reputation: 939Reputation: 939Reputation: 939Reputation: 939Reputation: 939Reputation: 939Reputation: 939Reputation: 939
Code:
zip(list1, list2)
This also works in Python 2.x
 
1 members found this post helpful.
Old 04-06-2010, 08:46 AM   #3
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,930

Original Poster
Rep: Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110
Thank you very much
 
  


Reply

Tags
map, python


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 08:30 PM
Convert python script to windows executable ankit_mcgill Linux - Newbie 4 10-05-2008 01:21 AM
rename files from list1 to list2 ulixes Linux - Software 2 08-12-2007 11:41 AM
convert while(<>) from perl to python bardinjw Programming 2 04-13-2006 08:21 AM
convert string to integer with python Kanaflloric Programming 2 05-27-2005 11:04 AM


All times are GMT -5. The time now is 01:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration