Bird
0
0

Given the code below, what will print(docs[0].page_content) output?

medium📝 component behavior Q13 of 15
LangChain - Document Loading
Given the code below, what will print(docs[0].page_content) output?
loader = WebBaseLoader("https://example.com")
docs = loader.load()
AThe plain text content extracted from https://example.com
BThe raw HTML source of https://example.com
CAn error because load() returns None
DA list of URLs found on https://example.com
Step-by-Step Solution
Solution:
  1. Step 1: Understand what load() returns

    WebBaseLoader's load() method returns a list of Document objects containing extracted plain text from the web page.
  2. Step 2: Identify what docs[0].page_content holds

    The first Document's page_content attribute holds the plain text extracted from the page, not HTML or URLs.
  3. Final Answer:

    The plain text content extracted from https://example.com -> Option A
  4. Quick Check:

    load() returns text documents = B [OK]
Quick Trick: load() returns text documents, not HTML or URLs [OK]
Common Mistakes:
  • Expecting raw HTML instead of extracted text
  • Assuming load() returns None or errors
  • Thinking it returns links instead of content

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes