如何使用Python grep从url返回的内容 [英] How do I grep contents which is returned from an url using Python

查看:90
本文介绍了如何使用Python grep从url返回的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://cidash.netact.nsn-rdnet.net/ciexecpools/list.php?show=name,offlinereason



需要grep oly自动锁定的内容

ex:clab511_main; AutoLock:netact17_2 / product / 17.2.1.133;

clab739_main; AutoLock:netact / product / 99.16。 11.0.109;



我尝试过:



导入请求



link =http://cidash.netact.nsn-rdnet.net/ciexecpools/list.php?show=name,offlinereason

f = requests.get(link)



print f.text

http://cidash.netact.nsn-rdnet.net/ciexecpools/list.php?show=name,offlinereason"

after running this link i need to grep oly the content which is auto locked
ex: clab511_main;AutoLock: netact17_2/product/17.2.1.133;
clab739_main;AutoLock: netact/product/99.16.11.0.109;

What I have tried:

import requests

link = "http://cidash.netact.nsn-rdnet.net/ciexecpools/list.php?show=name,offlinereason"
f = requests.get(link)

print f.text

推荐答案

参见 Python正则表达式 [ ^ ]。


这篇关于如何使用Python grep从url返回的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆