Truncate a file: Difference between revisions

added python
(added python)
Line 146:
ProcedureReturn #True
EndProcedure</lang>
 
=={{header|Python}}==
<lang python># Open a file for writing, and truncate it to 1234 bytes.
f = open("file")
f.truncate(1234)</lang>
 
=={{header|Ruby}}==
Line 153 ⟶ 158:
File.open("file", "ab") { |f| f.truncate(1234) }
 
# TrunateTruncate a file to 567 bytes.
File.truncate("file", 567)</lang>
 
Anonymous user