Can't sort my list because it is NoneType? Simple Python

前端 未结 2 1216
深忆病人
深忆病人 2020-12-03 12:35

I get this error when I try to figure out the low and high prices for my BeautifulSoup web scraper. I attached the code below. Shouldn\'t my list be a list of ints?

2条回答
  •  北海茫月
    2020-12-03 13:05

    Your problem is the line:

    intprices = intprices.sort()

    The .sort() method on a list operates on the list in-place, and returns None. Just change it to:

    intprices.sort()

提交回复
热议问题