how to make a hidden file in python

import os
# making a file called myFile.txt
open('myFile.txt', 'w')

# giving the file an attribute for hidden
os.system("attrib +h myFile.txt")

Here is what the above code is Doing:
1. We’re making a file called myFile.txt
2. We’re giving the file an attribute for hidden
3. We’re hiding the file