File creation

Aaron Sterling dhaaron at hotpop.com
Sun Nov 25 01:00:55 CET 2001


Hi,

    To create files, I am currently using:
        
        temp_file = os.open(file_name, O_CREAT)
        temp_file.close()
        open(file_name, 'w')

    Is this the cannonical way of doing it?  If so, would it be usefull to have a function, create_file(file_name, mode, bufsize), linked to the interpreter, that 
would create the file and return an associated file object? Is their a better way to do it, or is it something that shouldn't be done, and if so why?

Aaron, dhaaron at hotpop.com




More information about the Python-list mailing list