PyQuery 涔辩爜锛堝皢GB2312銆丟BK杞垚UTF-8锛�

PyQuery 寰堝ソ鐢紝浣嗘槸鍦ㄦ姄鍙� GB2312 缂栫爜鐨勬椂鍊欙紝鍚勭涔辩爜闂寰堟槸璁╀汉鎶撶媯銆�

杩欎釜鏃跺�欙紝浣跨敤requests鏉ユ悶瀹氬畠锛屽厛鐢� requests 鎶撳彇缃戦〉鍐呭锛岃浆鎹㈢紪鐮侊紝鍐嶄氦缁� PyQuery 鍘诲鐞嗐��

url = '缃戦〉URL'
r = requests.get(url)
r.encoding = 'gb2312'
d = pq(r.content)

鎼炲畾锛屾墦瀹屾敹宸�

你可能感兴趣的:(PyQuery 涔辩爜锛堝皢GB2312銆丟BK杞垚UTF-8锛�)