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
For Windows OS maybe to try something like this:
import os filename = open("file_name.txt", "w") filename.write("my text") filename.close() os.system("attrib +r file_name.txt")