LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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, 02:33 AM   #1
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,693

Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
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, 09:10 AM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,541

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

Original Poster
Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
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 09:30 PM
Convert python script to windows executable ankit_mcgill Linux - Newbie 4 10-05-2008 02:21 AM
rename files from list1 to list2 ulixes Linux - Software 2 08-12-2007 12:41 PM
convert while(<>) from perl to python bardinjw Programming 2 04-13-2006 09:21 AM
convert string to integer with python Kanaflloric Programming 2 05-27-2005 12:04 PM


All times are GMT -5. The time now is 01:51 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration