Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Big data Scala series files and regular expressions

Shulou Source: shulou.com Published: 2022-06-03 07:46:19 11月12日 Update

Big data Scala series files and regular expressions

1 read row

After importing scala.io.Source, you can refer to the method in Source to read the file information.

Import scala.io.Source

Object FileDemo extends App {

Val source = Source.fromFile ("C:/Users/admin/res.txt")

/ / return an iterator

Val lines = source.getLines ()

For (I)

Tags: Files expressions regular characters content strings methods words arrays iterations data special information parentheses letters objects quotes numbers slashes network Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Xiaomi macOS MySQL OPPO Reno