首页 > 解决方案 > 如何分离元组、字典和列表

问题描述

我有一个通过加入其他 rdd 形成的 rdd。由于我添加它的方式,它的方式很混乱。它具有以下形式:

('string',
([array],
{'string',
'string'}))

所以当我做 bc.first() 时它看起来像这样

('o9eMRCWt5PkpLDE0gOPtcQ',
 (['Italian', 'Restaurants'],
  {'Traumhaft. \nGemütlich und absolutes Spitzenniveau. \nMan kommt einfach an.\n\nDas Konzept ist wenig Produkte, dafür alles frisch und in Topqualität. \n\nDer Gruß aus der Küche war schon genial, das Foccacia und die Creme spitze. \n\nVorspeise und Hauptgerichte ein Traum.',
   'yJqCuWgVBBtFP6nGp6T1jw'}))

基本上我正在寻找的是

('string',
array,
'string',
'string')

对不起,如果这是模棱两可的,如果需要,我可以澄清。我对这种东西很陌生。

我已经研究过使用平面地图,但这对我不起作用。

标签: dictionarypysparktuples

解决方案


推荐阅读