LoginSignup
0
2

More than 5 years have passed since last update.

BeautifulSoupでWindows-31Jに遭遇した場合の対処方法

Last updated at Posted at 2017-09-06

Windows-31Jで変なことになる

所謂文字化けで何も読めない場合、単純にdecodeしても無理というときに対処法。

pip install chardet

Anacondaなら既に入ってます。
あとは、res.textとかしてたところを直すだけ。

test.py
res = requests.get(url)
soup = bs4.BeautifulSoup(res.content, 'lxml')
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2