当前位置:网站首页>Scala IO read by line
Scala IO read by line
2022-06-25 01:03:00 【Jue Niu thunder plough hot blade】
import scala.io.Source
// Source Class extends from Iterator
object D01_ According to the line read {
def main(args: Array[String]): Unit = {
// Register target objects
val source = Source.fromFile("./data/1.txt", "utf-8")
// Read in line bit units
val lines: Iterator[String] = source.getLines()
val list = lines.toList
for (data <- list) println(data)
// Release resources
source.close()
}
}
1.txt data
The spring river and the moon【 author 】 Zhang Ruoxu 【 Dynasty 】
The spring tide is even with the sea , The moon and the tide rise in the sea .
With the waves of thousands of miles , Where is the spring river without the moon !
The river flows around Fangdian , All the flowers in the forest are like graupel ;
I don't feel the frost flying in the air , White sand can't see on Ting .
There is no fine dust in the river , The lone moon in the sky .
Who by the river saw the moon for the first time ? At the beginning of the year, Jiang Yue took photos of people ?
Life is endless , Jiang Yue looks similar every year .
I don't know who Jiang Yue is waiting for , But see the Yangtze River sending water .
White clouds go all the way , The green maple is full of sorrow .
Who's going to boat tonight ? Where is the lovesickness moon tower ?
Poor Yue Pei , You should take a picture of the dressing table .
I can't roll in the Yuhu curtain , Whisk the clothes and anvil .
At this time, we don't know each other , May the moon shine on you .
The long flying light of wild geese is not enough , Fish and Dragons dive into the water .
Last night I dreamed of falling flowers , Poor spring will not return home .
The river flows away in spring , The moon falls on the river and the lake slopes to the West .
The slanting moon sinks into the sea mist , Jieshi Xiaoxiang infinite road .
I don't know how many people will come back in the month , The falling moon shakes all the trees in the river .
1.txt Location 
边栏推荐
- Sanic服务启动失败
- Custom control - round dot progress bar (imitating one key acceleration in security guard)
- 51 single chip microcomputer multi computer communication
- Kubernetes 架构核心组件工作原理解析
- Xcode preview displays a bug in the content of the list view and its solution
- Input series
- Custom animation (simulated win10 loading animation) - Optimization
- How to reduce the font size of custom controls (optimize the round dot progress bar)
- The drawableleft of the custom textview in kotlin is displayed in the center together with the text
- 【微服务|Sentinel】簇点链路|微服务集群环境搭建
猜你喜欢

Kubernetes 架构核心组件工作原理解析

【Redis实现秒杀业务③】超卖问题之乐观锁具体实现

Use of navigation and navigationui

Apk decompiled method (not confused)

ServerSocket and socket connection

【微服务|Sentinel】实时监控|RT|吞吐量|并发数|QPS

Custom control - round dot progress bar (imitating one key acceleration in security guard)

Practical operation notes - notebook plus memory and ash cleaning

QT(35)-操作EXCEL-QXlsx-QAxObject

傳輸層 以字節為單比特的滑動窗口技術
随机推荐
[microservices sentinel] cluster link | microservices cluster environment construction
腾讯云国际云服务器网络访问丢包问题解决办法
C# 闭包的垃圾回收
Hot fix sophix multi-channel patch solution
Go语言运算符(第8课下)
EVM简略
Golang示例续期锁:Redis+Channel+sync.Mutex
在企业级开发过程中我发现有位同事用select * from where 条件 for update
108 pages (40000 words) proposal for future apartment intelligent design platform project (version 2022)
实现mnist手写数字识别
Custom animation (simulated win10 loading animation)
How to reduce the font size of custom controls (optimize the round dot progress bar)
断言(assert)的用法
Leetcode 1248. Statistics of "graceful subarray" (harm, suddenly found that it can only enumerate violently)
生成订单30分钟未支付,则自动取消,该怎么实现?
ros(25):rqt_image_view报错Unable to load plugin for transport ‘compressed‘, error string
移动安全工具-dex2jar
Single blind box removal, social blind box and friend blind box program source code
A website for programmers with a monthly salary of 30K
Sanic服务启动失败