Fill two different lists using one source list that has all the data in python

  automation, pandas, python, selenium

This code is working properly, and I am able to print the users I Scrapped. However, my goal here is to split the list with all the names and put just the first one in the users_involved(which later will be a column) and the second in the users_involved2(also a column).
So the final result would be 2 columns with each user names that was scrapped in the list user_name. I tried to use a local list and get only the [0] and [1] for each column and it worked, but when I ran bigger inputs, it crashed saying list_index out of range. Someone has a suggestion? PS: The size represents the size of the DF, so I am populating this list and them create a COL.
Big thanks for taking the time to read this problem


'''Loop bootom elements to find Users and Clients'''
        user_name = [None] * size
        users_involved = [None] * size
        users_involved_2 = [None] * size
        
        elements_process = driver.find_elements_by_class_name("ElementIwasLooking")
        for el in elements_process:
            links = el.find_elements_by_css_selector('p')
            for phrase in links:
                if (phrase.text.startswith("User:")):
                    user_name[i] = phrase.text[10:]
                    users_involved[i] = user_name[i]
                    print(users_involved[i])

Source: Python Questions

LEAVE A COMMENT