私はPython 2.7.11を実行しています| Windows 10では、beautifulsoup4とlxmlを使用しています。Python HTMLページのタイトルから文字を再整列&削除する
import urllib2
import re
from bs4 import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen("http://www.daisuki.net/us/en/anime/watch.GUNDAMUNICORNRE0096.13142.html"), "lxml")
Name = soup.title.string
print(Name.replace('#', ""))
出力:
01 DEPARTURE 0096 - 機動戦士ガンダムユニコーンRE:0096 - だいすき
所望の出力:
機動戦士ガンダムユニコーンRE:0096 - 01 DEPARTURE 0096
最後に " - 大雪"を取り除いて文字列を再注文する方法はありますか?タイトルの