摘要: 可以看出头部是第一个元素,尾部还是一个列表 阅读全文
posted @ 2018-12-05 18:03 因为专注。所以专业 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 从上面代码可以看出,都不需要给出数组类型,Scala会自动根据提供的初始化数据来推断出数组的类型。 阅读全文
posted @ 2018-12-05 17:41 因为专注。所以专业 阅读(189) 评论(0) 推荐(0) 编辑
摘要: [hadoop@isstech001 ~]$ spark-submit --class WordCount /home/hadoop/WordCount.jar Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties 18/12/04 21:35:11 INFO SparkContext: R... 阅读全文
posted @ 2018-12-04 18:09 因为专注。所以专业 阅读(592) 评论(0) 推荐(0) 编辑
摘要: import scala.io.Source val inputFile = Source.fromFile("output.txt") val lines = inputFile.getLines for (line <- lines) println(line) //1、本地文件读取 val local_file_1 = sc.textFile("/home/hadoop/... 阅读全文
posted @ 2018-12-04 15:53 因为专注。所以专业 阅读(3367) 评论(0) 推荐(0) 编辑
摘要: //写入文本文件 //写入文件Scala需要使用java.io.PrintWriter实现把数据写入到文本文件。 import java.io.PrintWriter val out = new PrintWriter("output.txt") for (i <- 1 to 5) out.println(i) out.close() //写入文件时指定目录 import java.... 阅读全文
posted @ 2018-12-04 15:50 因为专注。所以专业 阅读(1011) 评论(0) 推荐(0) 编辑
摘要: val i = 5; val j = 8; printf("My name is %s. I hava %d apples and %d eggs.\n","wpGwoc",i,j) 阅读全文
posted @ 2018-12-04 15:23 因为专注。所以专业 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 1 to 10 1.to(10) 1 until 10 1 to 10 by 2 0.5f to 5.9f by 0.2f 阅读全文
posted @ 2018-12-04 15:21 因为专注。所以专业 阅读(445) 评论(0) 推荐(0) 编辑
摘要: /1、本地文件读取 val local_file_1 = sc.textFile("/home/hadoop/sp.txt") val local_file_2 = sc.textFile("file://home/hadoop/sp.txt") //2、当前目录下的文件 val file1 = sc.textFile("sp.txt") //3、HDFS文件 val hdfs_file1 ... 阅读全文
posted @ 2018-12-04 12:06 因为专注。所以专业 阅读(1358) 评论(0) 推荐(0) 编辑
摘要: Python3 实现游戏主播人气排行榜 阅读全文
posted @ 2018-08-21 19:04 因为专注。所以专业 阅读(556) 评论(0) 推荐(0) 编辑
摘要: # -*- coding:utf-8 -*- import time import api import auth ''' Python 装饰器 AOP 的编程思想 ''' # 对修改是封闭的,对扩展是开放的 # 当需求变更了,尽量不去改方法,类内部的实现 # 可以接受定义是的复杂,只要调用时足够简单(绝对不能接受调用的复杂) def print_current_time(func): ... 阅读全文
posted @ 2018-08-21 15:33 因为专注。所以专业 阅读(142) 评论(0) 推荐(0) 编辑