Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Python only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
Python
check file Existing with Python Script
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
Gabriel9999
New Member
Join Date:
Jul 2019
Posts:
15
#1
check file Existing with Python Script
Apr 23 '20, 04:38 PM
Are there any way to check the file existence in Python script.
Rabbit
Recognized Expert
MVP
Join Date:
Jan 2007
Posts:
12517
#2
Apr 23 '20, 07:22 PM
Import the os module and use the os.path.isfile( path) function
Comment
Post
Cancel
edizgeorgi
New Member
Join Date:
Oct 2019
Posts:
8
#3
Apr 24 '20, 11:30 AM
Python provides exists() function which can be used like below.
Code:
import os.path if(os.path.exists("/etc/passwd")): print("/etc/passwd exists")
Last edited by
Rabbit
;
Jun 11 '20, 07:20 PM
.
Reason:
Removed external link
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment