Python Programming - Reading and Writing Files - Discussion

Discussion Forum : Reading and Writing Files - General Questions (Q.No. 84)
84.
How can you check if a file named "data.txt" exists in the current directory?
if check_exists("data.txt"):
if file.exists("data.txt"):
if os.path.isfile("data.txt"):
if is_file("data.txt"):
Answer: Option
Explanation:
Using os.path.isfile() to check if the path refers to a regular file.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.