如何用函数递归地执行strlen?

时间:2017-10-26 13:13:12

标签: c recursion

我是以迭代方式制作的:

import requests
from bs4 import BeautifulSoup as BS
url_list = ['Http://www.aurecongroup.com',
'Http://www.burrell.com.au',
'Http://www.dsdbi.vic.gov.au',
'Http://www.energyaustralia.com.au',
'Http://www.executiveboard.com',
'Http://www.mallesons.com',
'Https://www.minterellison.com',
'Http://www.mta.org.nz',
'Http://www.services.nsw.gov.au']

try:
    for link in url_list:
        r = requests.get(link)    
        r.encoding = 'utf-8'
        html_content = r.text
        soup = BS(html_content, 'lxml')
        df = soup.title.string
        print(df)

except IOError:
    pass

任何人都可以通过递归进行此操作吗?

1 个答案:

答案 0 :(得分:1)

递归strlen:

int mylen(char *s) 
{
    if (!*s) return 0;
    return (mylen(s+1) + 1);
}