0
Follow
0
View

Problem with #python# : looking for a reason

dongshengye77 注册会员
2023-02-27 19:10

What is the error reported? Generally, it is correct to copy the xpath directly to the web page.

lidongmei_ 注册会员
2023-02-27 19:10

If the value of a in line 8 is empty list, the judgment in line 9 does not go in and line 10 does not run. In this case, if line 12 is judged to be true, line 14 out is an undefined variable.
can add initialization before line 8:

    a = list(set(txt))
    out = []
    if a:
        out = [x.strip() for x in a if x.strip() !='']


pp2775503 注册会员
2023-02-27 19:10

You do not post the error content, how to help you check

fan177 注册会员
2023-02-27 19:10
< div class = "md_content_show e397 data - v - 3967" = "" >

not an error, but no content output is why

mxliuyc 注册会员
2023-02-27 19:10

deathguy000 注册会员
2023-02-27 19:10

url = Hl. Xpath(f '/ / * [the < a > @ id = "content"] / div [18] / div [{I}] / / @ href') the written / @ href single diagonal < / a >

About the Author

Question Info

Publish Time
2023-02-27 19:10
Update Time
2023-02-27 19:10