Anonymous user
Read a specific line from a file: Difference between revisions
no edit summary
(→{{header|Icon}} and {{header|Unicon}}: + commentary) |
No edit summary |
||
Line 128:
assert linelist != [], 'Not 7 lines in file'
line = linelist[0]</lang>
=={{header|Scala}}==
The code will throw a ''NoSuchElementException'' if the file doesn't have 7 lines.
<lang python>
val lines = Source.fromFile("input.txt").getLines
val seventhLine = lines drop(6) next
</lang>
=={{header|Tcl}}==
|