LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Convert map(None, list1, list2) from Python 2.x to Python 3.x (https://www.linuxquestions.org/questions/programming-9/convert-map-none-list1-list2-from-python-2-x-to-python-3-x-800273/)

grail 04-06-2010 01:33 AM

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

ntubski 04-06-2010 08:10 AM

Code:

zip(list1, list2)
This also works in Python 2.x

grail 04-06-2010 08:46 AM

Thank you very much :D


All times are GMT -5. The time now is 08:34 PM.