pyspark.RDD.foreach

RDD.foreach(f)[source]

Applies a function to all elements of this RDD.

Examples

>>> def f(x): print(x)
>>> sc.parallelize([1, 2, 3, 4, 5]).foreach(f)