0
我正在运行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 - 机动战士UNICORN RE:0096 - DAISUKI
所需的输出:
机动战士UNICORN RE:0096 - 01出发0096
我将如何去除最后的“ - DAISUKI”并重新排序字符串?标题的