Hi, I’m very new to Python and have written a program to scrape for baseball player bio data.
I made a soup object and extracted all the data to a list. I expect it to have 7 items in each record. Some of them don’t have all 7 items filled in so my list is not coming out correctly. I have been manually adding to the list to get all the fields filled in. The problem is that in the original list it has the HTML tags with “text”. I can’t get the additions to have the same
My soup argument is: my_list2 = soup.find_all('span', class_='player-detail') it gives me 209 elements and I'm expecting 210 So I added the element using: [my_list2.insert(209, '<span class="player-detail"> no signer'), The problem I'm having is that the original data in the list is like this: [<span class="player-detail"> Aug 14, 1998 </span>, My added element comes out in the list like this: , '<span class="player-detail"> no signer', How can I get it to not be enclosed in ' ' so that it is recognized like all the other elements.
Thanks and I’m sure this is a very newbie question