check accessability of the file

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

showing results for - "check accessability of the file"
Sarah
02 Jun 2018
1print(os.access('sample.txt', os.R_OK))
2# Output False
3f = open("sample.txt", "x") #create the file
4#check again
5print(os.access('sample.txt', os.R_OK))
6# Output True