Skip to content
Advertisement

appending string to a list from an other list

well, I have 2 lists (names and bilananu2017) names contains the names of companies and bilananu2017 contain a pdf of each company there is some missing links the problem is that names length is 80 and bilananu2017 length is 75 i want both lists to be the same length so I can make a data frame. I have this idea of adding a string “null” in bilananu2017 for each missing link basically ill compare each company name with all the link if there a link that contains the campany name then append the link in a new list if not append(“null”) so at the end ill have a new list with the length of names where there is null for each missing link i tried this code

JavaScript

it does the work but for somehow bilananu2017 length is now 89 ??? its supposed to be 80 so i tried this code:

JavaScript

now I got an error that says bil is not defined well that’s obvious but how can I fix it ?

that’s what i have in names

JavaScript

in bilananu2017 its 75 links so ill put 4 so you can have an idea:

JavaScript

for example: the first name in names is “ab” if we try to look in the link for that name we will find that the first link contains “ab”

JavaScript

here /societes/ab

Advertisement

Answer

Try this it will work fine:

JavaScript

Output

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement