12
मैं एक विशेष HTML फ़ाइलब्यूटीफुल सूप यूनिकोड एनकोड त्रुटि
from BeautifulSoup import BeautifulSoup
import re
import codecs
import sys
f = open('test1.html')
html = f.read()
soup = BeautifulSoup(html)
body = soup.body.contents
para = soup.findAll('p')
print str(para).encode('utf-8')
मैं निम्नलिखित त्रुटि मिलती है साथ निम्नलिखित कोड कोशिश कर रहा हूँ:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 9: ordinal not in range(128)
मैं इस डिबग कैसे करूँ?
जब मैं फ़ंक्शन प्रिंट करने के लिए कॉल को हटाता हूं तो मुझे कोई त्रुटि नहीं होती है।