1

这是我的代码:

#coding=UTF-8
import urllib3
import http.client

http.client.HTTPConnection.debuglevel = 1

API_URL = 'http://www.nyaa.eu/'

http_pool = urllib3.connection_from_url(API_URL)
r = http_pool.request('GET',API_URL)
print (r.status)

输出如下:

send: b'GET http://www.nyaa.eu/ HTTP/1.1\r\nHost: www.nyaa.eu\r\nAccept-Encoding: identity\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Server header: Date header: Content-Type header: Transfer-Encoding header: Connection header: Vary 200

输出不包含\n. 阅读很困难。有没有办法格式化输出?

4

0 回答 0