+ 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())
2 Answers
+ 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 :)
+ 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}")