Code Snippet: Read File

From Coder Merlin
Revision as of 17:50, 24 December 2018 by Chukwuemeka-tinashe (talk | contribs)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Read the contents of a file into a string[edit]

Swift[edit]

import Foundation

let contents = try! String(contentsOfFile: "hello.txt")

Python[edit]