我们如何将ParArray[(Double, Double, Double, Double, Double)]
转换为Array[(Double, Double, Double, Double, Double)]
我必须使用sc.parallelize(Array[(Double,...)])
除了硬编码(如下所示)还有其他方法吗?
for(x1 <- 0 until a.length){
new_a(x1)(0) = a(x1)._1
new_a(x1)(1) = a(x1)._2
new_a(x1)(2) = a(x1)._3
new_a(x1)(3) = a(x1)._4
new_a(x1)(4) = a(x1)._5
}
答案 0 :(得分:1)
from sys import argv
from os.path import exists
import sys
import os
script,fromf,tof=argv
inf=open(fromf)
if exists(str(inf))==True:
indata=inf.read()
outf=open(tof,'w')
if exists(str(outf))==True:
print("Error! Output file exists.")
sys.exit()
else:
outf.write(indata)
print("The task is accomplished.")
else:
print("Error! Input file doesn't exists.")