Insert values of one list into another at every n position









up vote
2
down vote

favorite












Lots of examples on SO for inserting the same single value into another list at n positions, but can't find anything demonstrating the following:



Take the following lists:



list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
list2 = ['this', 'that', 'the', 'other']


Insert each value of list2 into list1 every 2 positions to return:



['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']


Alternatively just create a 3rd list with same result.










share|improve this question























  • So did you try adapting the examples you found to your specific needs? What happened?
    – jonrsharpe
    Nov 11 at 16:19










  • Yes I have a .py file which is a mess of attempts that isn't worth tidying up to post anything in here. This morning I thought this would be trivial. Seemingly not!
    – ls22
    Nov 11 at 16:22










  • @ls22 if your question was answered, please make sure to accept an answer for further references. You might ask for further clarification otherwise.
    – Ayxan
    Nov 11 at 16:58











  • @Ares Yup, I know how to use SO ;) Still reviewing the answers as they're all pretty good.
    – ls22
    Nov 11 at 17:16














up vote
2
down vote

favorite












Lots of examples on SO for inserting the same single value into another list at n positions, but can't find anything demonstrating the following:



Take the following lists:



list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
list2 = ['this', 'that', 'the', 'other']


Insert each value of list2 into list1 every 2 positions to return:



['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']


Alternatively just create a 3rd list with same result.










share|improve this question























  • So did you try adapting the examples you found to your specific needs? What happened?
    – jonrsharpe
    Nov 11 at 16:19










  • Yes I have a .py file which is a mess of attempts that isn't worth tidying up to post anything in here. This morning I thought this would be trivial. Seemingly not!
    – ls22
    Nov 11 at 16:22










  • @ls22 if your question was answered, please make sure to accept an answer for further references. You might ask for further clarification otherwise.
    – Ayxan
    Nov 11 at 16:58











  • @Ares Yup, I know how to use SO ;) Still reviewing the answers as they're all pretty good.
    – ls22
    Nov 11 at 17:16












up vote
2
down vote

favorite









up vote
2
down vote

favorite











Lots of examples on SO for inserting the same single value into another list at n positions, but can't find anything demonstrating the following:



Take the following lists:



list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
list2 = ['this', 'that', 'the', 'other']


Insert each value of list2 into list1 every 2 positions to return:



['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']


Alternatively just create a 3rd list with same result.










share|improve this question















Lots of examples on SO for inserting the same single value into another list at n positions, but can't find anything demonstrating the following:



Take the following lists:



list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
list2 = ['this', 'that', 'the', 'other']


Insert each value of list2 into list1 every 2 positions to return:



['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']


Alternatively just create a 3rd list with same result.







python






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 16:15









eyllanesc

70.8k93052




70.8k93052










asked Nov 11 at 16:12









ls22

235




235











  • So did you try adapting the examples you found to your specific needs? What happened?
    – jonrsharpe
    Nov 11 at 16:19










  • Yes I have a .py file which is a mess of attempts that isn't worth tidying up to post anything in here. This morning I thought this would be trivial. Seemingly not!
    – ls22
    Nov 11 at 16:22










  • @ls22 if your question was answered, please make sure to accept an answer for further references. You might ask for further clarification otherwise.
    – Ayxan
    Nov 11 at 16:58











  • @Ares Yup, I know how to use SO ;) Still reviewing the answers as they're all pretty good.
    – ls22
    Nov 11 at 17:16
















  • So did you try adapting the examples you found to your specific needs? What happened?
    – jonrsharpe
    Nov 11 at 16:19










  • Yes I have a .py file which is a mess of attempts that isn't worth tidying up to post anything in here. This morning I thought this would be trivial. Seemingly not!
    – ls22
    Nov 11 at 16:22










  • @ls22 if your question was answered, please make sure to accept an answer for further references. You might ask for further clarification otherwise.
    – Ayxan
    Nov 11 at 16:58











  • @Ares Yup, I know how to use SO ;) Still reviewing the answers as they're all pretty good.
    – ls22
    Nov 11 at 17:16















So did you try adapting the examples you found to your specific needs? What happened?
– jonrsharpe
Nov 11 at 16:19




So did you try adapting the examples you found to your specific needs? What happened?
– jonrsharpe
Nov 11 at 16:19












Yes I have a .py file which is a mess of attempts that isn't worth tidying up to post anything in here. This morning I thought this would be trivial. Seemingly not!
– ls22
Nov 11 at 16:22




Yes I have a .py file which is a mess of attempts that isn't worth tidying up to post anything in here. This morning I thought this would be trivial. Seemingly not!
– ls22
Nov 11 at 16:22












@ls22 if your question was answered, please make sure to accept an answer for further references. You might ask for further clarification otherwise.
– Ayxan
Nov 11 at 16:58





@ls22 if your question was answered, please make sure to accept an answer for further references. You might ask for further clarification otherwise.
– Ayxan
Nov 11 at 16:58













@Ares Yup, I know how to use SO ;) Still reviewing the answers as they're all pretty good.
– ls22
Nov 11 at 17:16




@Ares Yup, I know how to use SO ;) Still reviewing the answers as they're all pretty good.
– ls22
Nov 11 at 17:16












4 Answers
4






active

oldest

votes

















up vote
0
down vote



accepted










insert can be used to insert a single value to the list



Let's see what the documentation says about insert:




list.insert(i, x)



Insert an item at a given position. The first
argument is the index of the element before which to insert, so
a.insert(0, x) inserts at the front of the list, and a.insert(len(a),
x)
is equivalent to a.append(x).




Inserts before the given index. Let's have a look at an example implementation keeping that in mind:



def ins_n(lst1, lst2, n): # insert every n elements
indx1 = n
indx2 = 0
while(indx1 <= len(lst1)):
lst1.insert(indx1, lst2[indx2])
indx1 += 1 + n # add `1` because we insert before the given index
indx2 += 1
return lst1


Test it with your example lists and 2:



list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
list2 = ['this', 'that', 'the', 'other']

print(ins_n(list1, list2, 2))


Output:



['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





share|improve this answer





























    up vote
    1
    down vote













    You can use zip with a list comprehension and chunk list1 via this recipe:



    from itertools import chain

    def chunks(L, n):
    """Yield successive n-sized chunks from L."""
    for i in range(0, len(L), n):
    yield L[i:i + n]

    list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
    list2 = ['this', 'that', 'the', 'other']

    zipper = zip(chunks(list1, 2), list2)
    res = list(chain.from_iterable((x, y, z) for (x, y), z in zipper))

    ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





    share|improve this answer



























      up vote
      1
      down vote













      You can try following solution, simple and clean:



      list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
      list2 = ['this', 'that', 'the', 'other']

      i=2
      j=0
      while(j<len(list1) and j<len(list2)):
      list1.insert(i, list2[j])
      i=i+3
      j=j+1

      print(list1)





      share|improve this answer



























        up vote
        1
        down vote













        you can try the following code:



        def insert_list(old_list, new_list, n):
        for i, val in enumerate(new_list):
        old_list.insert(n+i*3, val)
        return old_list


        Test:



        list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
        list2 = ['this', 'that', 'the', 'other']
        print(insert_list(list1, list2, 2))


        Output:



        ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





        share|improve this answer






















        • I thought this answer was most elegant and ended up adapting it for my use case. I would have accepted the answer but just writing 'such?' isn't that useful for others who find this question in future. Keep up the good answers and consider adding a bit more context next time :)
          – ls22
          Nov 11 at 17:32










        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53250626%2finsert-values-of-one-list-into-another-at-every-n-position%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        0
        down vote



        accepted










        insert can be used to insert a single value to the list



        Let's see what the documentation says about insert:




        list.insert(i, x)



        Insert an item at a given position. The first
        argument is the index of the element before which to insert, so
        a.insert(0, x) inserts at the front of the list, and a.insert(len(a),
        x)
        is equivalent to a.append(x).




        Inserts before the given index. Let's have a look at an example implementation keeping that in mind:



        def ins_n(lst1, lst2, n): # insert every n elements
        indx1 = n
        indx2 = 0
        while(indx1 <= len(lst1)):
        lst1.insert(indx1, lst2[indx2])
        indx1 += 1 + n # add `1` because we insert before the given index
        indx2 += 1
        return lst1


        Test it with your example lists and 2:



        list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
        list2 = ['this', 'that', 'the', 'other']

        print(ins_n(list1, list2, 2))


        Output:



        ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





        share|improve this answer


























          up vote
          0
          down vote



          accepted










          insert can be used to insert a single value to the list



          Let's see what the documentation says about insert:




          list.insert(i, x)



          Insert an item at a given position. The first
          argument is the index of the element before which to insert, so
          a.insert(0, x) inserts at the front of the list, and a.insert(len(a),
          x)
          is equivalent to a.append(x).




          Inserts before the given index. Let's have a look at an example implementation keeping that in mind:



          def ins_n(lst1, lst2, n): # insert every n elements
          indx1 = n
          indx2 = 0
          while(indx1 <= len(lst1)):
          lst1.insert(indx1, lst2[indx2])
          indx1 += 1 + n # add `1` because we insert before the given index
          indx2 += 1
          return lst1


          Test it with your example lists and 2:



          list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
          list2 = ['this', 'that', 'the', 'other']

          print(ins_n(list1, list2, 2))


          Output:



          ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





          share|improve this answer
























            up vote
            0
            down vote



            accepted







            up vote
            0
            down vote



            accepted






            insert can be used to insert a single value to the list



            Let's see what the documentation says about insert:




            list.insert(i, x)



            Insert an item at a given position. The first
            argument is the index of the element before which to insert, so
            a.insert(0, x) inserts at the front of the list, and a.insert(len(a),
            x)
            is equivalent to a.append(x).




            Inserts before the given index. Let's have a look at an example implementation keeping that in mind:



            def ins_n(lst1, lst2, n): # insert every n elements
            indx1 = n
            indx2 = 0
            while(indx1 <= len(lst1)):
            lst1.insert(indx1, lst2[indx2])
            indx1 += 1 + n # add `1` because we insert before the given index
            indx2 += 1
            return lst1


            Test it with your example lists and 2:



            list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
            list2 = ['this', 'that', 'the', 'other']

            print(ins_n(list1, list2, 2))


            Output:



            ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





            share|improve this answer














            insert can be used to insert a single value to the list



            Let's see what the documentation says about insert:




            list.insert(i, x)



            Insert an item at a given position. The first
            argument is the index of the element before which to insert, so
            a.insert(0, x) inserts at the front of the list, and a.insert(len(a),
            x)
            is equivalent to a.append(x).




            Inserts before the given index. Let's have a look at an example implementation keeping that in mind:



            def ins_n(lst1, lst2, n): # insert every n elements
            indx1 = n
            indx2 = 0
            while(indx1 <= len(lst1)):
            lst1.insert(indx1, lst2[indx2])
            indx1 += 1 + n # add `1` because we insert before the given index
            indx2 += 1
            return lst1


            Test it with your example lists and 2:



            list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
            list2 = ['this', 'that', 'the', 'other']

            print(ins_n(list1, list2, 2))


            Output:



            ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 11 at 16:52

























            answered Nov 11 at 16:35









            Ayxan

            1,422115




            1,422115






















                up vote
                1
                down vote













                You can use zip with a list comprehension and chunk list1 via this recipe:



                from itertools import chain

                def chunks(L, n):
                """Yield successive n-sized chunks from L."""
                for i in range(0, len(L), n):
                yield L[i:i + n]

                list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
                list2 = ['this', 'that', 'the', 'other']

                zipper = zip(chunks(list1, 2), list2)
                res = list(chain.from_iterable((x, y, z) for (x, y), z in zipper))

                ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





                share|improve this answer
























                  up vote
                  1
                  down vote













                  You can use zip with a list comprehension and chunk list1 via this recipe:



                  from itertools import chain

                  def chunks(L, n):
                  """Yield successive n-sized chunks from L."""
                  for i in range(0, len(L), n):
                  yield L[i:i + n]

                  list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
                  list2 = ['this', 'that', 'the', 'other']

                  zipper = zip(chunks(list1, 2), list2)
                  res = list(chain.from_iterable((x, y, z) for (x, y), z in zipper))

                  ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





                  share|improve this answer






















                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    You can use zip with a list comprehension and chunk list1 via this recipe:



                    from itertools import chain

                    def chunks(L, n):
                    """Yield successive n-sized chunks from L."""
                    for i in range(0, len(L), n):
                    yield L[i:i + n]

                    list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
                    list2 = ['this', 'that', 'the', 'other']

                    zipper = zip(chunks(list1, 2), list2)
                    res = list(chain.from_iterable((x, y, z) for (x, y), z in zipper))

                    ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





                    share|improve this answer












                    You can use zip with a list comprehension and chunk list1 via this recipe:



                    from itertools import chain

                    def chunks(L, n):
                    """Yield successive n-sized chunks from L."""
                    for i in range(0, len(L), n):
                    yield L[i:i + n]

                    list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
                    list2 = ['this', 'that', 'the', 'other']

                    zipper = zip(chunks(list1, 2), list2)
                    res = list(chain.from_iterable((x, y, z) for (x, y), z in zipper))

                    ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 11 at 16:23









                    jpp

                    87.2k194999




                    87.2k194999




















                        up vote
                        1
                        down vote













                        You can try following solution, simple and clean:



                        list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
                        list2 = ['this', 'that', 'the', 'other']

                        i=2
                        j=0
                        while(j<len(list1) and j<len(list2)):
                        list1.insert(i, list2[j])
                        i=i+3
                        j=j+1

                        print(list1)





                        share|improve this answer
























                          up vote
                          1
                          down vote













                          You can try following solution, simple and clean:



                          list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
                          list2 = ['this', 'that', 'the', 'other']

                          i=2
                          j=0
                          while(j<len(list1) and j<len(list2)):
                          list1.insert(i, list2[j])
                          i=i+3
                          j=j+1

                          print(list1)





                          share|improve this answer






















                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            You can try following solution, simple and clean:



                            list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
                            list2 = ['this', 'that', 'the', 'other']

                            i=2
                            j=0
                            while(j<len(list1) and j<len(list2)):
                            list1.insert(i, list2[j])
                            i=i+3
                            j=j+1

                            print(list1)





                            share|improve this answer












                            You can try following solution, simple and clean:



                            list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
                            list2 = ['this', 'that', 'the', 'other']

                            i=2
                            j=0
                            while(j<len(list1) and j<len(list2)):
                            list1.insert(i, list2[j])
                            i=i+3
                            j=j+1

                            print(list1)






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 11 at 16:38









                            Omkar Nath Singh

                            1,7492925




                            1,7492925




















                                up vote
                                1
                                down vote













                                you can try the following code:



                                def insert_list(old_list, new_list, n):
                                for i, val in enumerate(new_list):
                                old_list.insert(n+i*3, val)
                                return old_list


                                Test:



                                list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
                                list2 = ['this', 'that', 'the', 'other']
                                print(insert_list(list1, list2, 2))


                                Output:



                                ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





                                share|improve this answer






















                                • I thought this answer was most elegant and ended up adapting it for my use case. I would have accepted the answer but just writing 'such?' isn't that useful for others who find this question in future. Keep up the good answers and consider adding a bit more context next time :)
                                  – ls22
                                  Nov 11 at 17:32














                                up vote
                                1
                                down vote













                                you can try the following code:



                                def insert_list(old_list, new_list, n):
                                for i, val in enumerate(new_list):
                                old_list.insert(n+i*3, val)
                                return old_list


                                Test:



                                list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
                                list2 = ['this', 'that', 'the', 'other']
                                print(insert_list(list1, list2, 2))


                                Output:



                                ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





                                share|improve this answer






















                                • I thought this answer was most elegant and ended up adapting it for my use case. I would have accepted the answer but just writing 'such?' isn't that useful for others who find this question in future. Keep up the good answers and consider adding a bit more context next time :)
                                  – ls22
                                  Nov 11 at 17:32












                                up vote
                                1
                                down vote










                                up vote
                                1
                                down vote









                                you can try the following code:



                                def insert_list(old_list, new_list, n):
                                for i, val in enumerate(new_list):
                                old_list.insert(n+i*3, val)
                                return old_list


                                Test:



                                list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
                                list2 = ['this', 'that', 'the', 'other']
                                print(insert_list(list1, list2, 2))


                                Output:



                                ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']





                                share|improve this answer














                                you can try the following code:



                                def insert_list(old_list, new_list, n):
                                for i, val in enumerate(new_list):
                                old_list.insert(n+i*3, val)
                                return old_list


                                Test:



                                list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] 
                                list2 = ['this', 'that', 'the', 'other']
                                print(insert_list(list1, list2, 2))


                                Output:



                                ['a', 'b', 'this', 'c', 'd', 'that', 'e', 'f', 'the', 'g', 'h', 'other']






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 9 hours ago

























                                answered Nov 11 at 16:42









                                Co.Q

                                112




                                112











                                • I thought this answer was most elegant and ended up adapting it for my use case. I would have accepted the answer but just writing 'such?' isn't that useful for others who find this question in future. Keep up the good answers and consider adding a bit more context next time :)
                                  – ls22
                                  Nov 11 at 17:32
















                                • I thought this answer was most elegant and ended up adapting it for my use case. I would have accepted the answer but just writing 'such?' isn't that useful for others who find this question in future. Keep up the good answers and consider adding a bit more context next time :)
                                  – ls22
                                  Nov 11 at 17:32















                                I thought this answer was most elegant and ended up adapting it for my use case. I would have accepted the answer but just writing 'such?' isn't that useful for others who find this question in future. Keep up the good answers and consider adding a bit more context next time :)
                                – ls22
                                Nov 11 at 17:32




                                I thought this answer was most elegant and ended up adapting it for my use case. I would have accepted the answer but just writing 'such?' isn't that useful for others who find this question in future. Keep up the good answers and consider adding a bit more context next time :)
                                – ls22
                                Nov 11 at 17:32

















                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53250626%2finsert-values-of-one-list-into-another-at-every-n-position%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                這個網誌中的熱門文章

                                How to read a connectionString WITH PROVIDER in .NET Core?

                                In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                                Museum of Modern and Contemporary Art of Trento and Rovereto