To add some variety to this chapter, we will now look at printing this data to a file. Again using Python, this is quite a simple and easy way to pick up. We will start by making a copy of our existing args.py. We will copy this to $HOME/bin/file.py. The new file.py should read similar to the following screenshot and have the execute permission set:
You will notice that we have just altered the final lines and instead of print we now open a file. We also see more of the object-orientated nature of Python, whereby it dynamically assigns the write() and close() methods to the object log, as it is seen as an instance ...