我正在使用proxyscrape获取免费proxy,但当前输出为:
Proxy(host='181.214.23.210', port='3129', code='us', country='united states', anonymous=True, type='https', source='us-proxy')
我怎样才能切分这个字符串,从而得到一个仅仅是IP:PORT的输出呢?你知道吗
我当前的代码是这样的:
from proxyscrape import create_collector
collector = create_collector('my-collector', 'http')
# Retrieve only 'us' proxies
proxygrab = collector.get_proxy({'code': 'us'})
print (proxygrab)
任何帮助都将不胜感激
proxygrab
不是字符串而是对象。您可以只打印元素:把它们结合起来:
将给出:
这将返回一个
collections.namedtuple
,因此您可以执行以下操作:提供:
相关问题 更多 >
编程相关推荐