How could I get the file name and the permissions to a file as a string? This is on a Linux system.
lewashby
56
Junior Poster
Recommended Answers
Jump to Post
str
function calls the appropriate method of the value to turn it to a string.
Jump to Post
os.access("myfilename", os.R_OK)
from Tkinter import * def fileopenbox(msg=None, title=None, default=None): root = Tk() root.withdraw() f = tkFileDialog.askopenfilename(parent=root,title=title, initialfile=default) if not f: return None return os.path.normpath(f)
Jump to Postuse
os.F_OK
for exsistence,os.R_OK
for read rights,os.W_OK
for write rights,os.X_OK
for execution rights
All 9 Replies
TrustyTony
888
pyMod
Team Colleague
Featured Poster
james.lu.75491856
0
Junior Poster
james.lu.75491856
0
Junior Poster
lewashby
56
Junior Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
lewashby
56
Junior Poster
richieking
44
Master Poster
Gribouillis
1,391
Programming Explorer
Team Colleague
james.lu.75491856
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.