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

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -