我有一个json如下:
{'body_text': [u'The',u'in Wynnewood, OK, just south of Oklahoma City,\xa0is h',u'eral different exotic animals:']}
如何获得输出:
{'body_text': [u'The in Wynnewood, OK, just south of Oklahoma City,\xa0is heral different exotic animals:']}
答案 0 :(得分:1)
您可以使用str.join
。这允许连接字符串列表,在其间插入另一个字符串:
d = {'body_text': [u'The',u'in Wynnewood, OK, just south of Oklahoma City,\xa0is h',u'eral different exotic animals:']}
d['body_text'] = ' '.join(d['body_text'])
print d
输出
{'body_text': 'The in Wynnewood, OK, just south of Oklahoma City,\xa0is h eral different exotic animals:'}