-2
我試圖讓英超表使用此代碼獲取:如何轉換unicode的,我要和BeautifulSoup
from bs4 import BeautifulSoup
import requests
url ="http://www.premierleague.com/en-gb.html"
r = requests.get(url)
soup = BeautifulSoup(r.content)
table = soup.find('table', {'class': 'leagueTable'})
rows = table.findAll('tr')
data = [[td.text for td in tr.findAll("td")] for tr in rows]
for i in data:
print i
一切都運行完美,但我得到的Unicode中的結果。如何將其轉換爲純文本?
這是有幫助嗎? http://stackoverflow.com/questions/1207457/convert-unicode-to-a-string-in-python-containing-extra-symbols – StefanNch
你可以編碼你的Unicode蜇傷。但爲什麼你想要它? – cubuspl42