Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to join 2 iterators
#1
you can join 2 lists with the + operator. but now we are getting iterators where we once got lists. usually they are effectively the same. but the + operator does not create a new iterator referencing the 2 iterators around it. is there a standard way to join 2 iterators? ideally, it would be able to handle more than 2 and a mix of iterators and sequences. if not, then i guess i need to code up another generator.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
itertools.chain
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
thank you!!
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  The difference between os.path.join( and os.sep.join( Pedroski55 2 1,383 Nov-17-2020, 08:38 AM
Last Post: Pedroski55
  itertools.zip_shortest() fo unequal iterators Skaperen 10 2,614 Dec-27-2019, 12:17 AM
Last Post: Skaperen
  iterating over 2 iterators Skaperen 2 891 Jun-07-2019, 11:37 PM
Last Post: Skaperen
  SQL select join operation in python(Select.. join) pradeepkumarbe 1 1,083 Feb-14-2019, 08:34 PM
Last Post: woooee
  Iterators mp3909 3 1,551 Mar-16-2018, 09:42 PM
Last Post: nilamo
  2 iterators or generators Skaperen 1 1,495 Jan-04-2018, 07:41 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020