I'm trying to open file using 'os.open()' as below
>>> filePath
'C:\\Shashidhar\\text.csv'
>>> fd = os.open(filePath,os.O_CREAT)
>>> with os.fdopen(fd, 'w') as myfile:
... myfile.write("hello")
IOError: [Errno 9] Bad file descriptor
>>>
Any idea how can I open the file object from os.fdopen using "with" so that connection can be closed automatially?
Thanks
use this form, it worked.