使用python:
将响应数据捕获到数组中当我使用urlib2读取网址时,我使用print resp在控制台中获得以下响应
code : resp = urllib2.urlopen(memberProfileInfo).read()
Console display
OCODE: 11
UCODE: XXX
GID: XXXXXX
GDISP: XXXXX
\# rc=0, count=1, message=Success
如何使用python 2.7将这些ocode等值捕获到数组中?
答案 0 :(得分:0)
I did this and it worked:
Code as below:
profdata = []
resp = urllib2.urlopen(memberProfileInfo).read()
profdata = resp.split('\n')
return profdata
However now in the excel I get all the response appended:
OCODE: 11 UCODE: XXX GID: XXXXXX GDISP: XXXXX \# rc=0, count=1, message=Success
Can we use regex and only capture data after : ? any suggestions here for the rest of the capture.