I occasionally use res.content
or res.text
to parse a response from Requests. In the use cases I have had, it didn't seem to matter which option I used.
What is the main difference in parsing HTML with .content
or .text
? For example:
import requests
from lxml import html
res = requests.get(...)
node = html.fromstring(res.content)
In the above situation, should I be using res.content
or res.text
? What is a good rule of thumb for when to use each?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…