Note that the write() method takes only string datatypes so you may need to convert integers to strings in order to be able to write them in a file.