|  | 
 
| 
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  复制代码import requests
import bs4
import sys
s = input("输入数列: ")
#s = "1,2,3,6,11,23,47,106,235"
res = requests.get("http://oeis.org/search?q=" + s + "&sort=&language=english&go=Search")
res.text
soup = bs4.BeautifulSoup(res.text, "html.parser")
titles = soup.find("td", align = "left", valign = "top").contents[3]
strt = str(titles)
for x in range(9, len(strt) + 1):
    if strt[x-5] == 'v' and strt[x-4] == 'a' and strt[x-3] == 'l' and strt[x-2] == 'i' and strt[x-1] == 'g'  and strt[x] == 'n':
        if strt[x-9] == 'f':
            print("规律为")
            for y in range(x + 8, len(strt) + 1):
                if strt[y] == '<':
                    print("自行翻译成中文~")
                    sys.exit(0)
                print(strt[y], end="")
 爬得网站是 http://oeis.org
 就是有点慢
 | 
 |