python vsc ターミナルで呼び出すと以下のようなエラーがでます
=============================================
File "pyconjp2016_talk.py", line 18
title = presentation_title.replace('\xa0(ja)' , ' ' ))
===================================================
↑これはどうすればいいでしょうか
書いてるコードが⇓です(書籍スラスラpythonより)
======================================================
import requests
from bs4 import BeautifulSoup
result = requests.get('https://pycon.jp/2016/ja/schedule/talks/list/')
soup = BeautifulSoup(result.text,'html.parser')
listy = soup.find_all('div', class_='presentation')
print('language | title')
print('---------|-------')
for presentation_html in listy:
presentation_title = presentation_html.h3.get_text()
if'(en)' in presentation_title: language = 'English' title = presentation_title.replace('\xa0(en)','') elif '(ja)' in presentation_title: language = 'japanese' title = presentation_title.replace('\xa0(ja)' , ' ' )) print('{0} | {1}'.format(language,title))
========================================================================================
回答1件
あなたの回答
tips
プレビュー