Error type: TypeError: 'method' object is not subscriptable

It may be due to the function in parentheses wrong, or where writing is not standardized

Error codes are as follows:

title=li.xpath[".//a/@href"]

  

At this point it will error: TypeError: 'method' object is not subscriptable

Modified:

title=li.xpath(".//a/@href")

  

correct.

Guess you like

Origin www.cnblogs.com/wcyMiracle/p/12466477.html