python - How to take all the words in a list element as a variable -


i have following program, in trying pass list of elements consecutive google searches:

search_terms = ['telejob (eth)', 'luisa da silva','the cern recruitment services'] el in search_terms:     webpage = 'http://google.com/search?q='+el)     print('xxxxxxxxxxxxxxxxxxx')     print(webpage) 

unfortunately program not taking words in each list item, taking first one, giving me output:

http://google.com/search?q=telejob (eth) xxxxxxxxxxxxxxxxxxx http://google.com/search?q=luisa da silva xxxxxxxxxxxxxxxxxxx http://google.com/search?q=the cern recruitment services xxxxxxxxxxxxxxxxxxx http://google.com/search?q=the swiss national science foundation 

altough can see whole item every word being added search above, when verify link, going concatenating element first word of each item, such:

http://google.com/search?q=telejob xxxxxxxxxxxxxxxxxxx http://google.com/search?q=luisa xxxxxxxxxxxxxxxxxxx http://google.com/search?q=the xxxxxxxxxxxxxxxxxxx http://google.com/search?q=the 

what doing wrong , what's solution concatenate words in each list item google search?

thank you

this line:

webpage = 'http://google.com/search?q='+el) 

should split , joined %20 joiner:

webpage = 'http://google.com/search?q='+'%20'.join(el.split())) 

Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -