错误int函数python

时间:2018-02-02 19:07:43

标签: python function int

我想在python

中将str转换为int时收到错误

我的代码

[name for name in names if not User.select().where(User.name == name).exists()]

回溯:

from bs4 import BeautifulSoup as bs
import requests


link_cat = 'http://www.www.uol.com.br/'
r = requests.get(link)


soup = bs(r.content, "lxml")


for div in soup.find_all('a', {"class" : "last-page"}):
lp = div['href']



import re



regex = r"^.*\/([0-9]+)\/$"

#Define str
strlp = lp


matches = re.search(regex, strlp)



if matches:

for groupNum in range(0, len(matches.groups())):
    groupNum = groupNum + 1

valor_final = matches.group(groupNum)
valor_final = int(matches.group(groupNum))

print(valor_final)
type(valor_final)

0 个答案:

没有答案