check check writability of the file

Solutions on MaxInterview for check check writability of the file by the best coders in the world

showing results for - "check check writability of the file"
Shane
24 May 2020
1os.access('sample.txt', os.W_OK)
2#Output False
3f = open("sample.txt", "x") # create the file
4#check again
5os.access('sample.txt', os.W_OK)
6#Output True