Python 常例
print(BeautifulSoup(requests.get(‘http://ip.cn’).text, ‘lxml’).select(‘#result > div > p > code’)[1]) url = input(‘请输入需要爬取的页面:’) title.strip(‘#*|’) 删除字符 re.compile(‘test.*?to’, re.DOTALL) 多行正则匹配 dir0=str(os.getcwd()).replace(‘\\’,’/’) list0 = os.listdir(dir0) 列出当前文件夹所有文件及文件夹 mkey=str(z).replace(‘–’,’ ‘).replace(‘-‘,’ ‘).replace(‘.’,’ ‘).replace(‘ ‘,’ ‘).replace(‘ ‘,”).strip() blk0 = browser.find_element_by_xpath(‘//*[@id=”filesystem_grid_1″]/table/tbody/tr[4]/td[1]’) browser.execute_script(“arguments[0].style.display=’block’;”, blk0)
. Read more
