articles=response.css("#content > article:nth-child(5) p")
sgg="";
for item in articles:
sgg = sgg+item.extract()
data=urllib.urlencode({ 'title':title ,"describle":describle,"article":sgg} );
我想把sgg+item.extract() 转换为字符串.转换为urlcode.发送出去.
不过我碰到问题是这个
articles=response.css("#content > article:nth-child(5) p")
for item in articles: print ( type(item.extract()) )
输出
<type 'unicode'>
所以如果
data = {
'title': title,
'describle': describle,
'article': article
}
print urllib.urlencode(data);
就报错了
I don’t know what you mean by efficient, please post a more readable code
Please compare this code again