Write entire file
Write entire file
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
(Over)write a file so that it contains a string.
The reverse of Read entire file—for when you want to update or create a file which you would read in its entirety all at once.
PHP
<lang php>file_put_contents($filename, $data)</lang>
Python
<lang python> with open(filename, 'w') as f:
f.write(data)
</lang>