Python 放弃res.read()状态文本中的标题

Python 放弃res.read()状态文本中的标题,python,django,Python,Django,此行status\u msg=res.read()获取状态消息 some heading|more headings|even more heading 0|OK|eb725f96b4b094d5f8318741cc1a545f-2 但是,我希望status_msg放弃第一行文本(标题),只获取从0开始的第二行 谢谢 res = urllib.urlopen(self.base_url, data) status_msg = res.read() 可以在以下行上拆分: status_msg

此行
status\u msg=res.read()
获取状态消息

some heading|more headings|even more heading
0|OK|eb725f96b4b094d5f8318741cc1a545f-2 
但是,我希望status_msg放弃第一行文本(标题),只获取从0开始的第二行

谢谢

res = urllib.urlopen(self.base_url, data)
status_msg = res.read()

可以在以下行上拆分:

status_msg = '\n'.join(res.read().splitlines()[1:])
甚至:

status_msg = '\n'.join(res.readlines()[1:])
status_msg = '\n'.join(res.readlines()[1:])
或者在响应中调用
.readline()
,以放弃第一行:

res.readline()  # discard the first line
status_msg = res.read()

可以在以下行上拆分:

status_msg = '\n'.join(res.read().splitlines()[1:])
甚至:

status_msg = '\n'.join(res.readlines()[1:])
status_msg = '\n'.join(res.readlines()[1:])
或者在响应中调用
.readline()
,以放弃第一行:

res.readline()  # discard the first line
status_msg = res.read()
使用
res.readlines()
,它将返回结果消息的行列表

使用
res.readlines()
,它将返回结果消息的行列表