Recent Changes - Search:

Oktatás

* Programozás 2
  + feladatsor
  + C feladatsor
  + Python feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

* Adator. prog.
  + feladatsor
  + quick link

Teaching

* Prog. for Data Sci. (TODO)

teaching assets


Félévek

* 2025/26/1
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

Read the lines of a text file to a list of strings

See also std.file.

(1) read to list
def main():
    f = open("input.txt", "r")

    lines = f.read().splitlines()

    f.close()
import std.stdio;
import std.file; // readText()
import std.string; // splitLines()

void main()
{
    string[] lines = readText("input.txt").splitLines();

    writeln(lines);
}

Output:

$ cat input.txt
first line.
second line.
last line

$ rdmd main.d
["first line.", "second line.", "last line"]
Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2025 June 28, 19:17