View Problem

Write a string to a file

DiskEdit
python
open('test.txt', 'wt').write('Hello World!')
ExpandDiskEdit
clojure
(with-out-writer "output.txt" (println "Hello file!"))
ExpandDiskEdit
erlang
Line = "This line overwites file contents!\n",
{ok, IODevice} = file:open("test.txt", [write]), file:write(IODevice, Line), file:close(IODevice).
ExpandDiskEdit
fantom
File(`out.txt`).out.writeChars("some text").flush
ExpandDiskEdit
fsharp
let stream = new StreamWriter("test.txt", false)
stream.WriteLine("This line overwrites file contents!")

Submit a new solution for python, clojure, erlang, fantom ...
There are 14 other solutions in additional languages (cpp, csharp, groovy, haskell ...)