标签:clip api can 函数 正则表达式 sel search iss hat
import re a = "123456789@qq.com" b = ‘020-88770099‘ mail = re.search(‘\d{6,12}@[a-zA-Z0-9]+.[a-zA-Z0-9]+‘, a).group(0) tele_num = re.search(‘\d{3,4}-\d{6,8}‘, b).group(0) print(mail+‘\n‘+tele_num)
import re new = ‘‘‘I‘ve been reading books of old The legends and the myths Achilles and his gold Hercules and his gifts Spiderman‘s control And Batman with his fists And clearly I don‘t see myself upon that list She said where‘d you wanna go How much you wanna risk I‘m not looking for somebody With some Superhuman gifts Some Superhero Some fairytale bliss Just something I can turn to Somebody I can kiss I want something just like this Doo doo doo doo doo doo Doo doo doo doo doo Doo doo doo doo doo doo Oh I want something just like this Doo doo doo doo doo doo Doo doo doo doo doo Doo doo doo doo doo doo Oh I want something just like this I want something just like this I‘ve been reading books of old The legends and the myths The testaments they told The moon and its eclipse And Superman unrolls A suit before he lifts But I‘m not the kind of person that it fits She said where‘d you wanna go How much you wanna risk I‘m not looking for somebody With some Superhuman gifts Some Superhero Some fairytale bliss Just something I can turn to Somebody I can miss I want something just like this I want something just like this Oh I want something just like this Doo doo doo doo doo doo Doo doo doo doo doo Doo doo doo doo doo doo Oh I want something just like this Doo doo doo doo doo doo Doo doo doo doo doo Doo doo doo doo doo doo Where‘d you wanna go How much you wanna risk I‘m not looking for somebody With some Superhuman gifts Some Superhero Some fairytale bliss Just something I can turn to Somebody I can kiss I want something just like this Oh I want something just like this Oh I want something just like this Oh I want something just like this‘‘‘ a = re.split("[\s+\n\.\,\‘]", new) print(a)
import requests from bs4 import BeautifulSoup as bs import re def req(url): res = requests.get(url=url) return res def get_hit(res): html = res.content.decode(‘utf-8‘) hit_num = html.split(‘.html‘)[-1][2:-3] print(hit_num) def page_url(res): soup = bs(res.content.decode(‘utf-8‘), ‘html.parser‘) page_url = soup.select(‘.news-list li a‘) return page_url if __name__ == ‘__main__‘: url = ‘http://news.gzcc.cn/html/xiaoyuanxinwen/‘ j_url = ‘http://oa.gzcc.cn/api.php?op=count&id={}&modelid=80‘ res = req(url) page_url = page_url(res) for p in page_url: p_url = p.get(‘href‘) id = re.findall(‘(\d+/\d+)‘,p_url)[0].split(‘/‘)[1] p_res = req(j_url.format(str(id))) get_hit(p_res)
标签:clip api can 函数 正则表达式 sel search iss hat
原文地址:https://www.cnblogs.com/lzhshuai/p/8758727.html