Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
101 views
in Technique[技术] by (71.8m points)

python - AttributeError: 'function' object has no attribute 'text'

Do you know repl.it?

I am coding python on this site. And my goal is creating Web Scraper. I think this code is clean. But I'm getting an error:

AttributeError: 'function' object has no attribute 'text'

My code:

import requests

indeed_result = requests.get
("https://kr.indeed.com/jobs?q=python&l=%EC%9D%B8%EC%B2%9C")

print(indeed_result.text)

Surely, I have requests package installed. Please give me some advice

question from:https://stackoverflow.com/questions/65643217/attributeerror-function-object-has-no-attribute-text

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You just need to remove the back to new line after get like this:

import requests

indeed_result = requests.get("https://kr.indeed.com/jobs?q=python&l=%EC%9D%B8%EC%B2%9C")

print(indeed_result.text) 

if you want to continue typping in the next line just add a backslash as follows:

indeed_result = requests.get
("https://kr.indeed.com/jobs?q=python&l=%EC%9D%B8%EC%B2%9C")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...