我正在学习python,并尝试从Wikipedia检索数据,但是却给我有关链接,文本等特殊字符的编码问题:
我的代码:
$user = User::find(1);
$user->touch();
结果:
import sys
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("https://pt.wikipedia.org/wiki/Jair_Bolsonaro")
bsObj = BeautifulSoup(html)
for link in bsObj.findAll("a"):
if 'href' in link.attrs:
print(link.attrs['href'])
答案 0 :(得分:0)
解决方案:
gsend () {
git commit -am "$1"
git pull
git push
}
并且在打印行中更改为:
import urllib.parse