i wish write beautifulsoup form code:
soup = beautifulsoup(con.content) f = open('/*/*/desktop/littletext.rtf','w') f.write(str(soup)) f.close() i error:
traceback (most recent call last): file "///desktop/test123.py", line 10, in f.write(soup) typeerror: must str, not beautifulsoup
any ideas how fix this? tried convert 'soup' string didn't work -- f.write(str(soup))
found out problem had use 'wb' in f = open('/*/*/desktop/littletext.rtf','wb') , f.write(str(soup)) had f.write(soup.encode('utf-8'))
Comments
Post a Comment