当前位置:网站首页>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 
边栏推荐
- Scala classes inherit multiple attributes
- 移动安全工具-jar
- Practical operation notes - notebook plus memory and ash cleaning
- Sanic service startup failed
- The picture of wechat official account can not be displayed normally
- Apk decompiled method (not confused)
- 2021-11-05
- 2022 simulated 100 questions of safety officer-c certificate examination and online simulated examination
- Using tcp/udp tools to debug the yeelight ribbon
- Xcode预览(Preview)显示List视图内容的一个Bug及解决
猜你喜欢

Tiktok wallpaper applet v1.0.2 function, new arrival function
最新QQ微信域名防红PHP程序源码+强制跳转打开

2022年危险化学品经营单位安全管理人员考试试题及模拟考试

Sliding window technology based on byte in transport layer

Scala IO reads by lexical units and numbers

Databinding quick start (still using findviewbyid?)

【微服务|Sentinel】Sentinel快速入门|构建镜像|启动控制台
![[redis realizes seckill service ②] solution to oversold problem](/img/b6/3073def06a56565894c28e49767e3e.png)
[redis realizes seckill service ②] solution to oversold problem

ros(25):rqt_ image_ View reports an error unable to load plugin for transport 'compressed', error string

Apk decompiled method (not confused)
随机推荐
Single blind box removal, social blind box and friend blind box program source code
Usage of assert
Scala trait exercise
The basic principle and application of iterator and enhanced for
Sliding window technology based on byte in transport layer
移动安全工具-dex2jar
通过kubernetes可视化界面(rancher)安装kibana
Working principle analysis of kubernetes architecture core components
Binder mechanism and Aidl communication example
Mobile security tool -dex2jar
iNFTnews | 国内NFT发展仅限于数字藏品吗?
2022年危险化学品经营单位安全管理人员考试试题及模拟考试
Thermodynamic diagram display correlation matrix
Qiniu cloud uploads video to get the first frame of video
Redis + Lua implementation of distributed interface current limiting
Realization of MNIST handwritten numeral recognition
In the process of enterprise development, I found that a colleague used the select * from where condition for update
JS dynamically generates variable names and assigns values
我想问一下兴业证券怎么开户?通过链接办理股票开户安全吗
【无标题】