我正在使用BeautifulSoup向使用python的difflib库时生成的html添加按钮。这几乎完美地工作了-唯一的问题是我输出中的所有空格现在都是黑钻石问号。你知道吗
依稀,我的函数是这样的:
def addbuttons():
global differencehtml
soup = BeautifulSoup(differencehtml, 'html.parser')
# edit soup here
differencehtml = soup.prettify()
当我在chrome中打开输出文件时,所有空格都被黑色问号所取代。我不认为这与我正在做的编辑有关,因为如果我注释掉addbuttons(),并得到以下代码:
soup = BeautifulSoup(differencehtml, 'html.parser')
differencehtml = soup.prettify()
我最终还是用黑钻石问号代替空格: like in this screenshot
prettify()对空格有什么影响?我怎样才能解决这个问题?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐