Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在抓取网站并将数据保存在 djnago 模型中。
我有这条线
item.title = site.select('dl/dd/h2/a').select("string()").extract()
但数据以这种格式保存
[u'Master Developer']
我该如何解决这个问题,以便只有主开发人员才能被保存
你打算这样做吗...
In [35]: l = [u'Master Developer'] In [36]: str(l[0]) Out[36]: 'Master Developer'
或者
In [37]: l[0].encode('utf-8') Out[37]: 'Master Developer'