Hello, I wrote the following program and tried to execute it:
#!/usr/bin/python3.8
import os
# The file has no directory entries associated with it and will be
# deleted automatically once there are no file descriptors.
tmpfile = os.tmpfile()
tmpfile.write('Temporary newfile is here......')
tmpfile.seek(0)
print (tmpfile.read())
tmpfile.closebut I'm getting an error:Error:Traceback (most recent call last):
File "/home/user/Desktop/Programming/Python/Os tmpfile method.py", line 5, in <module>
tmpfile = os.tmpfile()
AttributeError: module 'os' has no attribute 'tmpfile'
