我想将文件中的键值写为vals。我希望你能帮助我。谢谢。
File.open(resfile,'a+') do |f2|
gname.each {|key,val| val.each {|x| f2.write(x) f2.write("\t")}
f2.write("\n")}
end
答案 0 :(得分:1)
result = gname.map { |_key, val| val.join("\t") }.join("\n")
File.write(resfile, result)
答案 1 :(得分:0)
我想你的意思是:
if (this.config.lang != 'en'){
console.log("in Translate");
Promise.all([
translate(alerts.description, {to: this.config.lang}),
translate(alerts.expires, {to: this.config.lang}),
translate(alerts.message, {to: this.config.lang})
]).then(function(results) {
// results[0], results[1], results[2] contain the three results
// use those three values in the code inside this callback
})
}