Reputation: 3
I have a project of web scraping . I want to get the name of something for searching as input and add it to the end of my url . i tried the code bellow but it didn't work, the input did not become a part of url
search = input()
url= 'https://www.digikala.com/search/?q='+search
Upvotes: -1
Views: 1344
Reputation: 15488
Here f-strings
were not introduced before python 3.7 so use .format
instead then:
search = input()
url= 'https://www.digikala.com/search/?q={}'.format(search)
Upvotes: 1
Reputation: 4125
This should work, try it:
search = input()
url= f'https://www.digikala.com/search/?q={search}'
This is called f-string
formatting.
Upvotes: 1