sc.parallelize(["one", "two", "two", "three", "three", "three"]).map(lambda x: (x,1)).repartition(1).saveAsTextFile("feature/all.txt")

load方法:

a=sc.textFile("feature/all.txt")
a.collect()

[u"('one', 1)", u"('two', 1)", u"('two', 1)", u"('three', 1)", u"('three', 1)", u"('three', 1)"]

相关文章:

  • 2021-11-10
  • 2021-06-03
  • 2021-11-18
  • 2021-11-09
  • 2021-05-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-08-22
相关资源
相似解决方案