Checking File permissions
Larry Bates
larry.bates at websafe.com
Thu Jul 20 10:11:30 EDT 2006
Note: You really don't have to post the same question
3 times (2 in response to yourself).
import os
if os.path.exists(pathname):
<do something>
To see if a file is writeable:
import stat
def iswriteable(path):
mode=os.stat(path)[stat.ST_mode]
return bool(stat.S_IMODE(mode) & stat.S_IWRITE)
Larry Bates
Anoop wrote:
> Hi All
>
> Please tell me how to check the existence of a file and the read
> permission to the file using python script
>
> Thanks for ur inputs
>
> Anoop
>
More information about the Python-list
mailing list