So for creating files I use the following:
fileHandle = open(\'fileName\', \'w\')
then write the contents to the file, close the file. In t
You can use StringIO as a virtual file , from official documentation
from io import StringIO
output = StringIO()
output.write('First line.\n')
print >>output, 'Second line.'
# Retrieve file contents -- this will be
# 'First line.\nSecond line.\n'
contents = output.getvalue()
# Close object and discard memory buffer --
# .getvalue() will now raise an exception.
output.close()