首页 > 解决方案 > accessing property in text response python 3

问题描述

I'm trying to access a response from a http request using python requests library. The response comes in a text format, json is not available

import requests
resp = requests.get('http://url.com')
print(resp.text)
=> login=http://new_url.com?anylock=9f8s9g0asd&calls=vlsdu2

I need the value after login= so would it be a good approach to use resp.split('login=')[1]

标签: pythonpython-3.x

解决方案


推荐阅读