I am writing a data processing code, in which I create a new file, write processed data in to this file and close. But the file has to be closed in read-only mode, so that i
I guess you could use os module after writing on your file to change the file permissions like this:
import os filename=open("file_name","w") filename.write("my text") filename.close() os.system("chmod 444 file_name")