apache spark - pyspark print one item in each line -


in pyspark, when try print list, elements printed in same line :

>>> wordslist = words.collect(); >>> wordslist [(u'crazy', 1), (u'fox', 1), (u'jumped', 1)] 

is there way output printed 1 item per line, :

>>> wordslist [ (u'crazy', 1), (u'fox', 1), (u'jumped', 1) ] 

this basic python. when collect result rdd. obtain list can iterate on , print each element in format wish.

i think question on how print list had been answered many times in so.

and here 1 example.

$> mylist = myrdd.collect() $> elem in mylist: $>     print elem  

you'd want check pyspark documentation .


Comments