def tst4trycounttimes2(): if not_IPython(): ifttt_notify("test for ifttt notify", f"{__file__}") @trycounttimes2('xmu.edu.cn网站服务器') def fetchfromnet(addressin: object): """ 从网址获取内容 :param addressin: 网址 :return: 页面内容html """ r = requests.get(addressin) html = r.content return html # html2 = trycounttimes2(fetchfromnet, '', True, 'xmu.edu.cn网站服务器') address = 'http://www.wise.xmu1.edu.cn/people/faculty' print(fetchfromnet.__doc__) html2 = fetchfromnet(address) if html2 is None: exit(5) soup = BeautifulSoup(html2, 'html.parser') # html.parser是解析器 div_people_list = soup.find('div', attrs={'class': 'people_list'}) a_s = div_people_list.find_all('a', attrs={'target': '_blank'}) for a in a_s: url = a['href'] name = a.get_text() print(f'{name},{url}')
print(imglst) if (device_name := getinivaluefromnote('device', device_id)) is None: device_name = device_id imglist2note( get_notestore(), imglst, guid, f'手机_{device_name}_location更新记录', tablehtml2evernote( df4dis.sort_index(ascending=False).iloc[:100, ], "坐标流水记录单")) # %% [markdown] # ## 主函数main # %% if __name__ == '__main__': if not_IPython(): log.info(f'运行文件\t{__file__}……') dout = chuli_datasource() foot2show(dout) # showdis() if not_IPython(): log.info(f"完成文件{__file__}\t的运行") # %% def sampledef(dout): df = dout.copy(deep=True) df.sort_index(ascending=False).iloc[:100, ] def is_normal(timed):
cfpin.add_section(sectionname) cfpin.write(open(cfpinpath, 'w', encoding='utf-8')) return else: return cfpin.items(f'{sectionname}') is_log_details = getcfpoptionvalue('everinifromnote', 'everwork', 'logdetails') # cfp, inifilepath = getcfp('everwork') # cfpdata, inidatanotefilepath = getcfp('everdatanote') # cfplife, inilifepath = getcfp('everlife') # cfpzysm, inizysmpath = getcfp('everzysm') # cfpworkplan, iniworkplanpath = getcfp('everworkplan') if __name__ == '__main__': if not_IPython() and is_log_details: print(f'开始测试文件\t{__file__}') # cp, cppath = getcfp('everwork') # print(cp, cppath) cfpapiname = 'everapi' inipathson = Path(getdirmain()) / 'data' / (cfpapiname + '.ini') name = '[notestore]' cp, cppath = getcfp(cfpapiname) print(cp) # removesection(cfpapiname, nssectionname) # ict = fixinifile(inipathson) seccontent = getcfpsectionvalue('everwork', 'evernote') print(seccontent) if not_IPython() and is_log_details: print('Done.')