+ 1

Python concatenate URL issue :(

Hi, Please could someone help me fix the below error? - 'builtin_function_or_method' has no len() Here is my code: search = input("Search: ") source = requests.get("https://www.test.com/search/keyword.php?keyword= %s " % (search)).text.format soup = BeautifulSoup(source, 'lxml') for event in soup.findAll(class_ = "TEST"): print ((event).get_text())

13th Dec 2020, 5:41 PM
Lew
Lew - avatar
2 Réponses
+ 2
Hi, It seems the ".format" was causing the issue. Removed this and it is now working. Not too sure why i was using this but i will still try your method. Thanks :)
13th Dec 2020, 6:40 PM
Lew
Lew - avatar
+ 1
#it is tough to say, can you provide the stack trace and full code? #using a f-string might help source = requests.get(f"https://www.test.com/search/keyword.php?keyword={search}")
13th Dec 2020, 5:52 PM
Steven M
Steven M - avatar