Purpose of get()/getall()

What is the difference between
{
quote = response.css(“div.quote”)[0]

In [31]: title = quote.css(‘span.text::text’).get()

In [32]: print(title)
}

AND

{
quote = response.css(“div.quote”).get()

In [31]: title = quote.css(‘span.text::text’).get()

In [32]: print(title)
}

Why does the second code not work ?
What does get()/getall() attribute actually return ?
This error was encountered in video lecture too but no explanation was given.

Please at least reply, it has been a long time since I posted this

hey @18127,
We are really sorry to reply you so late.

This get function returns a string value , which is currently actually a html code in form of string. Hence , it doesn’t have function css and hence returns error.

These are simple functions to get some tags from the response variable we create. Get function returns a single result and getall() returns a list of all results that can be extracted from the page depending upon the query.

I hope this would have helped you.
Thank You :slightly_smiling_face:.