Search code examples
pythonpyrevit

combinding each items for both list separet.py


I have tried to search for the answer but I can't find it.

I have two lists. Both lists have 71 items.

I want every index in both lists to be combined.


Solution

  • You could do something like this:

    extensions =['.sp1', '.sp1', '.sp2']
    my_numbers =[4, 16, 128]
    new_list = []
    
    for x in range(len(my_numbers)):
        new_list.append("".join([str(my_numbers[x]), extensions[x]]))
    
    print(new_list)
    

    Output:

    ['4.sp1', '16.sp1', '128.sp2']